Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. C++ is love

C++ is love

Scheduled Pinned Locked Moved The Lounge
csharpc++
86 Posts 24 Posters 11 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    honey the codewitch wrote:

    I needed some garbage-collector like advantages

    Now all you need to do is add heap compacting[^] and maybe heap compression[^]. :-D

    honey the codewitchH Offline
    honey the codewitchH Offline
    honey the codewitch
    wrote on last edited by
    #14

    Then that would be an actual garbage collector, which I'm trying to avoid. :-D Actually what I'm doing is kind of clever. I allow you to allocate a "MemoryPool" on the heap or the stack, and then allocate memory from that pool. It does not allow you to delete. However, all allocated segments are always contiguous and sequential, leading to a number of performance advantages. Instead of deleting single allocations you can freeAll() to reset/recycle the entire pool and invalidate the memory therein. It's actually quite nice for a lot of basic processing scenarios. it's just inefficient for mutable data where sizes can change - which it's not designed for.

    Real programmers use butterflies

    J 1 Reply Last reply
    0
    • Sander RosselS Sander Rossel

      Ok, now give it a name that references literature, something like "Quixote Garbage Collector". Then make a slogan that's inspired by LOTR, maybe "I am Gandalf the White and I've come to collect your garbage" or "There is no curse in Elvish, Entish, or the tongues of Men for this garbage collector." Now live out your life as Facebook, Google, Microsoft or Apple buys you out for quintagazillions$$$ and share some with me :D (For those who miss the joke, read post below)

      Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

      C Offline
      C Offline
      CodeWraith
      wrote on last edited by
      #15

      You don't simply collect Garbage in Mordor! :-)

      I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.

      J 1 Reply Last reply
      0
      • honey the codewitchH honey the codewitch

        Yeah which is why i don't use it. I have StaticMemoryPool<C> which can allocate a fixed amount of data from the heap or the stack (capacity C known at compile time) and DynamicMemoryPool which allocates a capacity specified at runtime, but always from the heap. using dynamic stack allocations is messy because its intertwined with scope. Plus it goes out of scope with the function ends making wrapping it not a thing. Maybe that's why it's warned against. *shrug* I really don't know.

        Real programmers use butterflies

        W Offline
        W Offline
        W Balboos GHB
        wrote on last edited by
        #16

        It's only scope, certainly how I used it, was within the function - scope was never a problem. Memory wasn't humongous, then, so allocations were done with care, anyway. There was expanded and extended memory.* It's built in (usually) and automatic. About the only complaint I found really valid is that it's existence in a compiler is not (or was not) guaranteed as it was an official standard. It happened to be everywhere I was (QuickC, MS-C, Wacom-C) on DOS and NT, manly; Now I live in a stateless world of web development. I will say, however, that with the 400 users, an occasional server request gets an out-of-memory error. I increased it in php.ini a couple of times, but for the most part, the DBA and I share info and he forces filters them to not ask for a million records. A better long-term solution. *I made a page-swapper so I could access lots of it smoothly beyond the 64K in the original page frame.

        Ravings en masse^

        "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

        "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

        1 Reply Last reply
        0
        • C CodeWraith

          You don't simply collect Garbage in Mordor! :-)

          I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.

          J Offline
          J Offline
          Jorgen Andersson
          wrote on last edited by
          #17

          Garbage shall not pass.

          Wrong is evil and must be defeated. - Jeff Ello Never stop dreaming - Freddie Kruger

          C 1 Reply Last reply
          0
          • J Jorgen Andersson

            Garbage shall not pass.

            Wrong is evil and must be defeated. - Jeff Ello Never stop dreaming - Freddie Kruger

            C Offline
            C Offline
            CodeWraith
            wrote on last edited by
            #18

            I reserve that one for some unit test. "YOU ! Shall! Not! Pass!" :-)

            I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.

            1 Reply Last reply
            0
            • raddevusR raddevus

              How much can you sell it for? And/or can you get 1 million (or more) devs to use it? That's our modern (cynical) measure for success so get on board. :rolleyes:

              S Offline
              S Offline
              Slacker007
              wrote on last edited by
              #19

              raddevus wrote:

              How much can you sell it for?

              That's capitalism, and htcw does not believe in that. :)

              honey the codewitchH 1 Reply Last reply
              0
              • honey the codewitchH honey the codewitch

                I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.

                Real programmers use butterflies

                S Offline
                S Offline
                Slacker007
                wrote on last edited by
                #20

                Sure, C++ is love, but at what price does this "love" cost? your soul, I am sure. We are talking about C++ here. :laugh:

                honey the codewitchH 1 Reply Last reply
                0
                • honey the codewitchH honey the codewitch

                  I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.

                  Real programmers use butterflies

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #21

                  What's a line of code?

                  honey the codewitchH 1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    What's a line of code?

                    honey the codewitchH Offline
                    honey the codewitchH Offline
                    honey the codewitch
                    wrote on last edited by
                    #22

                    magic! :laugh:

                    Real programmers use butterflies

                    1 Reply Last reply
                    0
                    • honey the codewitchH honey the codewitch

                      It doesn't really do garbage collection as such. As an analogy imagine the garbage man came once a week and burned your house down. It's much more time and space efficient than taking out the trash. You can't actually delete objects in my scheme, only allocate to pools. You can recycle entire pools though, manually, freeing (invalidating) all pointers (or objects) therein. Doing it that way makes it fast fast fast and it works on constrained memory environments. Also it was easy to code.

                      Real programmers use butterflies

                      Sander RosselS Offline
                      Sander RosselS Offline
                      Sander Rossel
                      wrote on last edited by
                      #23

                      honey the codewitch wrote:

                      burned your house down. It's much more time and space efficient than taking out the trash.

                      How the heck is burning down a house every week efficient? :laugh:

                      Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                      honey the codewitchH 1 Reply Last reply
                      0
                      • Sander RosselS Sander Rossel

                        honey the codewitch wrote:

                        burned your house down. It's much more time and space efficient than taking out the trash.

                        How the heck is burning down a house every week efficient? :laugh:

                        Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                        honey the codewitchH Offline
                        honey the codewitchH Offline
                        honey the codewitch
                        wrote on last edited by
                        #24

                        It saves you from having to take the garbage out. ;P

                        Real programmers use butterflies

                        Sander RosselS 1 Reply Last reply
                        0
                        • S Slacker007

                          Sure, C++ is love, but at what price does this "love" cost? your soul, I am sure. We are talking about C++ here. :laugh:

                          honey the codewitchH Offline
                          honey the codewitchH Offline
                          honey the codewitch
                          wrote on last edited by
                          #25

                          My soul? Oh that old thing? I think I traded it for some concert tickets back in the day.

                          Real programmers use butterflies

                          1 Reply Last reply
                          0
                          • honey the codewitchH honey the codewitch

                            It saves you from having to take the garbage out. ;P

                            Real programmers use butterflies

                            Sander RosselS Offline
                            Sander RosselS Offline
                            Sander Rossel
                            wrote on last edited by
                            #26

                            That's more like deleting your entire application to solve a single bug... :~ Maybe you just don't know how analogies work? :laugh:

                            Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                            honey the codewitchH 1 Reply Last reply
                            0
                            • honey the codewitchH honey the codewitch

                              It doesn't really do garbage collection as such. As an analogy imagine the garbage man came once a week and burned your house down. It's much more time and space efficient than taking out the trash. You can't actually delete objects in my scheme, only allocate to pools. You can recycle entire pools though, manually, freeing (invalidating) all pointers (or objects) therein. Doing it that way makes it fast fast fast and it works on constrained memory environments. Also it was easy to code.

                              Real programmers use butterflies

                              pkfoxP Offline
                              pkfoxP Offline
                              pkfox
                              wrote on last edited by
                              #27

                              Article methinks - I think you should write a book - *Random thoughts of a clever mad Witch* :-D

                              "I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP

                              1 Reply Last reply
                              0
                              • honey the codewitchH honey the codewitch

                                I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.

                                Real programmers use butterflies

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #28

                                Also confusing language and libraries. e.g. C++ managed and unmanaged.

                                It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

                                1 Reply Last reply
                                0
                                • honey the codewitchH honey the codewitch

                                  I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.

                                  Real programmers use butterflies

                                  R Offline
                                  R Offline
                                  Rick York
                                  wrote on last edited by
                                  #29

                                  Some of us find the light again. Some of us never lose it.

                                  "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                                  1 Reply Last reply
                                  0
                                  • honey the codewitchH honey the codewitch

                                    I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.

                                    Real programmers use butterflies

                                    Greg UtasG Offline
                                    Greg UtasG Offline
                                    Greg Utas
                                    wrote on last edited by
                                    #30

                                    When I saw your post, I wondered how badly you were going to get flamed, given the popularity of C# on this site. I never thought this thread would stay so civilized, let alone be fairly positive. :)

                                    Robust Services Core | Software Techniques for Lemmings | Articles
                                    The fox knows many things, but the hedgehog knows one big thing.

                                    <p><a href="https://github.com/GregUtas/robust-services-core/blob/master/README.md">Robust Services Core</a>
                                    <em>The fox knows many things, but the hedgehog knows one big thing.</em></p>

                                    honey the codewitchH N 2 Replies Last reply
                                    0
                                    • honey the codewitchH honey the codewitch

                                      I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.

                                      Real programmers use butterflies

                                      R Offline
                                      R Offline
                                      r_hyde
                                      wrote on last edited by
                                      #31

                                      I don't hate C++, but I don't share your sentiments. This is almost certainly my own failing, though—it's not a problem with the language so much (which is alright, I guess), I just always end up fighting with the compiler/linker. I've never worked with C++ enough to become much more than minimally competent with it.

                                      honey the codewitchH 1 Reply Last reply
                                      0
                                      • honey the codewitchH honey the codewitch

                                        I gave it away under the MIT license. It was just a little bit of code anyway.

                                        Real programmers use butterflies

                                        raddevusR Offline
                                        raddevusR Offline
                                        raddevus
                                        wrote on last edited by
                                        #32

                                        honey the codewitch wrote:

                                        I gave it away under the MIT license.

                                        GitHub link, or it didn't happen. :laugh:

                                        honey the codewitchH 1 Reply Last reply
                                        0
                                        • raddevusR raddevus

                                          honey the codewitch wrote:

                                          I gave it away under the MIT license.

                                          GitHub link, or it didn't happen. :laugh:

                                          honey the codewitchH Offline
                                          honey the codewitchH Offline
                                          honey the codewitch
                                          wrote on last edited by
                                          #33

                                          GitHub - codewitch-honey-crisis/MemoryPool: Small fixed size sequential memory pool allocators for constrained memory environments[^] :laugh:

                                          Real programmers use butterflies

                                          K raddevusR U 3 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups