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.
  • 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
    #27

    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

      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
      #28

      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

        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
                • R r_hyde

                  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 Offline
                  honey the codewitchH Offline
                  honey the codewitch
                  wrote on last edited by
                  #34

                  There's a certain point - and it can take awhile with C++ - where you reach a level that it is no longer intimidating or as frustrating. True, I did recently spend all morning and ask a stackoverflow question because I missed a "=0" at the end of one of my functions and was responded to with "missing vtable for class" or some such, but that's life, you know? :laugh:

                  Real programmers use butterflies

                  1 Reply Last reply
                  0
                  • Greg UtasG Greg Utas

                    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.

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

                    I share your surprise. :)

                    Real programmers use butterflies

                    1 Reply Last reply
                    0
                    • Sander RosselS Sander Rossel

                      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 Offline
                      honey the codewitchH Offline
                      honey the codewitch
                      wrote on last edited by
                      #36

                      No, that's basically how my code works.

                      Real programmers use butterflies

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

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

                        Real programmers use butterflies

                        K Offline
                        K Offline
                        k5054
                        wrote on last edited by
                        #37

                        I see you're using both #pragma once and #ifdef include guards. Is that really necessary? GCC supports both, going back to at least version 4.8, so the #pragma doesn't even need to be wrapped in an #ifdef _MSC_VER. But maybe you know something I don't, or maybe you're using some other compiler that doesn't understand the #pragma? Also, picking nits, since I have nothing better to offer, I see that this is a memory pool for contrained memory environments. That must be a constrained, contained memory situation, correct? :)

                        Keep Calm and Carry On

                        R honey the codewitchH 2 Replies Last reply
                        0
                        • K k5054

                          I see you're using both #pragma once and #ifdef include guards. Is that really necessary? GCC supports both, going back to at least version 4.8, so the #pragma doesn't even need to be wrapped in an #ifdef _MSC_VER. But maybe you know something I don't, or maybe you're using some other compiler that doesn't understand the #pragma? Also, picking nits, since I have nothing better to offer, I see that this is a memory pool for contrained memory environments. That must be a constrained, contained memory situation, correct? :)

                          Keep Calm and Carry On

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

                          I used to put a test of the preprocessor in headers :

                          #pragma once

                          #ifdef HEADER_H
                          #error pragma once was ignored
                          #else
                          #define HEADER_H
                          #endif

                          I have not used very many compilers but I never saw the error message. I use only VS now so I don't do that any more.

                          "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?"

                          honey the codewitchH 1 Reply Last reply
                          0
                          • K k5054

                            I see you're using both #pragma once and #ifdef include guards. Is that really necessary? GCC supports both, going back to at least version 4.8, so the #pragma doesn't even need to be wrapped in an #ifdef _MSC_VER. But maybe you know something I don't, or maybe you're using some other compiler that doesn't understand the #pragma? Also, picking nits, since I have nothing better to offer, I see that this is a memory pool for contrained memory environments. That must be a constrained, contained memory situation, correct? :)

                            Keep Calm and Carry On

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

                            GCC throws a "#pragma once in main file" if I don't guard against them appearing. OTOH MSVC seems to like #pragma once to be in there for its source editors.

                            Real programmers use butterflies

                            1 Reply Last reply
                            0
                            • R Rick York

                              I used to put a test of the preprocessor in headers :

                              #pragma once

                              #ifdef HEADER_H
                              #error pragma once was ignored
                              #else
                              #define HEADER_H
                              #endif

                              I have not used very many compilers but I never saw the error message. I use only VS now so I don't do that any more.

                              "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?"

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

                              I could do that but I'd rather recover gracefully. What I did compiles with no warnings and that's my major concern.

                              Real programmers use butterflies

                              1 Reply Last reply
                              0
                              • S Slacker007

                                raddevus wrote:

                                How much can you sell it for?

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

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

                                I'm economically agnostic. No systems devised by humans survive contact with them.

                                Real programmers use butterflies

                                D S 2 Replies Last reply
                                0
                                • honey the codewitchH honey the codewitch

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

                                  Real programmers use butterflies

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

                                  :thumbsup::thumbsup::thumbsup: :)

                                  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

                                    1 Offline
                                    1 Offline
                                    11917640 Member
                                    wrote on last edited by
                                    #43

                                    honey the codewitch wrote:

                                    The only downside with it is it hides nothing

                                    Actually, it does. Time to move to Assembly.

                                    honey the codewitchH 1 Reply Last reply
                                    0
                                    • raddevusR raddevus

                                      :thumbsup::thumbsup::thumbsup: :)

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

                                      I'm still kind of massaging the code. It's so simple it works as is and will probably remain basically the same, but I've tweaked little things like changed the template parameter from C to TCapacity I'm still not sure I like so I haven't recommitted yet but any changes will be minor.

                                      Real programmers use butterflies

                                      1 Reply Last reply
                                      0
                                      • 1 11917640 Member

                                        honey the codewitch wrote:

                                        The only downside with it is it hides nothing

                                        Actually, it does. Time to move to Assembly.

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

                                        Okay that's fair, except I can't think of much I can't get to in C++ with the right massaging of the compiler. I can manually build vtbls, i can make call stack frames myself, typically, I can even drop to inline assembly if I really want. So I see it more as giving you more tools than ASM. I don't think it takes anything away.

                                        Real programmers use butterflies

                                        Greg UtasG 1 Reply Last reply
                                        0
                                        • W W Balboos GHB

                                          Back in the days of yore, when I did my C programming, I discovered alloca(). Used inside of functions, instead of malloc() (for example), it would free allocated memory when you left the function. I didn't look into the workings but I'd presume it used the stack for memory. Update: Quick Search [^] and it's in C++, too - and it does use the stack for allocatons.

                                          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

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

                                          One of the problems with stack allocation is on platforms like the ESP32 and most of the arduinos, they don't give you a lot of stack space. I know usually one grows up and the other grows down but I run out of stack declaring 2kB blocks sometimes so there might be some kind of artificial limit. That's why I usually use the heap for my pools.

                                          Real programmers use butterflies

                                          1 Reply 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