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. Why I hate C++

Why I hate C++

Scheduled Pinned Locked Moved The Lounge
c++question
60 Posts 23 Posters 0 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.
  • D den2k88

    It's not C++, it's the programmers. I use C++ and don't do that s**t.

    GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

    M Offline
    M Offline
    Munchies_Matt
    wrote on last edited by
    #4

    And this 20 year old code base has evidently seen some right clowns have a go at it!

    D 1 Reply Last reply
    0
    • M Munchies_Matt

      And this 20 year old code base has evidently seen some right clowns have a go at it!

      D Offline
      D Offline
      den2k88
      wrote on last edited by
      #5

      Any 20 years old code base saw its sharse of clowns, especially the self-taught enthusiast that follow any "guru" blindly. I had such a colleague, luckily he went out slamming the door... unfortunately he had 10 years to make damages. I recently had to update some of his code and I was happy that he was no longer in my proxymity or I would be writing this from behind bars.

      GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

      M 1 Reply Last reply
      0
      • M Munchies_Matt

        some_array[value];

        [] is over ridden and is commented as // find element matching _Keyval or insert with default mapped Which actually means 'insert it at the end of the list'. Why not a function called 'add_to_map_at_end'? Christ I hate C++ sometimes, it is so up its arse pointless at times.

        D Offline
        D Offline
        dan sh
        wrote on last edited by
        #6

        Suddenly a wild overloaded operator appears... Try stand up comedy. :)

        "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

        1 1 Reply Last reply
        0
        • D den2k88

          It's not C++, it's the programmers. I use C++ and don't do that s**t.

          GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

          J Offline
          J Offline
          jeron1
          wrote on last edited by
          #7

          While I agree with your statement, std::map implements this very [] operator overload as described. Actually that comment is a nice addition. Would I implement something like that though? probably not.

          "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

          M 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            Hey! You can do stupid things in any language, if you try hard. Back in my FORTRAN days, I discovered you could write self modifying code with judicious misuse of COMMON ... you can't do it now, but back then? Handy... :cringe:

            Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

            R Offline
            R Offline
            Rage
            wrote on last edited by
            #8

            OriginalGriff wrote:

            if you try hard.

            And the lazies use VB.

            Do not escape reality : improve reality !

            K 1 Reply Last reply
            0
            • M Munchies_Matt

              some_array[value];

              [] is over ridden and is commented as // find element matching _Keyval or insert with default mapped Which actually means 'insert it at the end of the list'. Why not a function called 'add_to_map_at_end'? Christ I hate C++ sometimes, it is so up its arse pointless at times.

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

              Operator overloading can result in some of the worst abuses of the language. Usually the overloads are intuitive and reduce your typing but they can be easily taken beyond that into the realm of the absurd. I recently wrote my own little vector and matrix library for 3D graphics and there are some overloads in it that I think are sensible. For example, I have a point class that stores three coordinates and it has an [] overload that returns the coordinate at that index. This lets you write point[index] instead of point.coordinates[index]. That makes sense to me and I would not want it to do anything else behind the scene. The example you cite is beyond what I consider to be intuitive. It would be best to have explicit methods to implement that functionality instead of an overridden operator in my opinion. I don't hate C++ at all. What I hate is when people try to get cute with it as in your example. I don't think it enhances the readability or maintainability of the code at all if one has to figure out what is going with a statement like that.

              1 Reply Last reply
              0
              • M Munchies_Matt

                some_array[value];

                [] is over ridden and is commented as // find element matching _Keyval or insert with default mapped Which actually means 'insert it at the end of the list'. Why not a function called 'add_to_map_at_end'? Christ I hate C++ sometimes, it is so up its arse pointless at times.

                I Offline
                I Offline
                Ian Bell 2
                wrote on last edited by
                #10

                -1 for blaming an excellent tool when the real problem lies with (s)he who uses it...

                History is the joke the living play on the dead.

                M 1 Reply Last reply
                0
                • M Munchies_Matt

                  some_array[value];

                  [] is over ridden and is commented as // find element matching _Keyval or insert with default mapped Which actually means 'insert it at the end of the list'. Why not a function called 'add_to_map_at_end'? Christ I hate C++ sometimes, it is so up its arse pointless at times.

                  T Offline
                  T Offline
                  TheGreatAndPowerfulOz
                  wrote on last edited by
                  #11

                  What you should really be hating on is the abhorrent coder not the language. That's like hating the hammer that was used to build the crappy shack you live in.

                  #SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                  M 1 Reply Last reply
                  0
                  • OriginalGriffO OriginalGriff

                    Hey! You can do stupid things in any language, if you try hard. Back in my FORTRAN days, I discovered you could write self modifying code with judicious misuse of COMMON ... you can't do it now, but back then? Handy... :cringe:

                    Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

                    G Offline
                    G Offline
                    Gary Wheeler
                    wrote on last edited by
                    #12

                    OriginalGriff wrote:

                    FORTRAN

                    OriginalGriff wrote:

                    self modifying code

                    OriginalGriff wrote:

                    misuse of COMMON

                    What. The. :elephant:.

                    Software Zen: delete this;

                    OriginalGriffO 1 Reply Last reply
                    0
                    • M Munchies_Matt

                      some_array[value];

                      [] is over ridden and is commented as // find element matching _Keyval or insert with default mapped Which actually means 'insert it at the end of the list'. Why not a function called 'add_to_map_at_end'? Christ I hate C++ sometimes, it is so up its arse pointless at times.

                      N Offline
                      N Offline
                      Nish Nishant
                      wrote on last edited by
                      #13

                      There may be reasons to dislike C++, but surely this one is a programmer induced problem. :~

                      Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com

                      K 1 Reply Last reply
                      0
                      • G Gary Wheeler

                        OriginalGriff wrote:

                        FORTRAN

                        OriginalGriff wrote:

                        self modifying code

                        OriginalGriff wrote:

                        misuse of COMMON

                        What. The. :elephant:.

                        Software Zen: delete this;

                        OriginalGriffO Offline
                        OriginalGriffO Offline
                        OriginalGriff
                        wrote on last edited by
                        #14

                        COMMON allowed you to share variables between different blocks of code: much like a C++ global variable being accessible from different classes. But ... it wasn't type checked, so you could declare a float and then use COMMON to import it as a 7 dimensional array of BYTE values if you wanted. Because the array bounds checking worked on the data as declared in the COMMON statement with no actual reference back to the original variable, you could happily use it to access any location in your memory space. And because there was no physical separation between code and data segments (flat memory model in those days) your code was not in a "read only partition" as code is now. Provided you understood machine code you could revise your program while it was running ... :laugh:

                        Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

                        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                        pkfoxP G 2 Replies Last reply
                        0
                        • OriginalGriffO OriginalGriff

                          COMMON allowed you to share variables between different blocks of code: much like a C++ global variable being accessible from different classes. But ... it wasn't type checked, so you could declare a float and then use COMMON to import it as a 7 dimensional array of BYTE values if you wanted. Because the array bounds checking worked on the data as declared in the COMMON statement with no actual reference back to the original variable, you could happily use it to access any location in your memory space. And because there was no physical separation between code and data segments (flat memory model in those days) your code was not in a "read only partition" as code is now. Provided you understood machine code you could revise your program while it was running ... :laugh:

                          Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

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

                          Interesting times

                          We can’t stop here, this is bat country - Hunter S Thompson RIP

                          OriginalGriffO 1 Reply Last reply
                          0
                          • pkfoxP pkfox

                            Interesting times

                            We can’t stop here, this is bat country - Hunter S Thompson RIP

                            OriginalGriffO Offline
                            OriginalGriffO Offline
                            OriginalGriff
                            wrote on last edited by
                            #16

                            We committed some serious atrocities in the name of efficiency back then. :-O

                            Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

                            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                            K 1 Reply Last reply
                            0
                            • OriginalGriffO OriginalGriff

                              We committed some serious atrocities in the name of efficiency back then. :-O

                              Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

                              K Offline
                              K Offline
                              kalberts
                              wrote on last edited by
                              #17

                              Not as much for speed - more to overcome space limitations. I am too young to have any PDP-8 experience, but an older colleauge told that every single one of the 4094 memory locations - 12 bit data values, 12 bit addresses - was precious. If you had to use a constand, you would always look through the entire binary program to see if the value was already used somewhere, usually as an instruction code, rather that wasting a whole 12 bit word on a duplicate... Yet, with 4096 twelve-bit words, they managed to make a complete newspaper typesetting system (they had hand coded a segment swapping system to read code from a 5 Mbyte (later: 10 Mbyte) disk. Only once did a customer demand all the options, and they couldn't fit all the resident parts into RAM. So they sold that newspaper a 2-CPU solution: When a function in CPU 1 needed to call some code that couldn't fit it, it raised an interrupt signal to CPU 2, the interrupt ID identifying the required function, and went to sleep while CPU 2 was working. Return from the function, in CPU 2, generated an interrupt back to CPU 1, interrupt ID being the result status, so that CPU 1 would wake up and continue its work... I heard about this around 1980, at a time when the PDP-8s had been replaced by PDP-11s serveral years ago, so I guess the story dates to around 1970 ("Computer Techniques A/S", later renamed "Comtec AS", was founded in 1967).

                              1 Reply Last reply
                              0
                              • OriginalGriffO OriginalGriff

                                Hey! You can do stupid things in any language, if you try hard. Back in my FORTRAN days, I discovered you could write self modifying code with judicious misuse of COMMON ... you can't do it now, but back then? Handy... :cringe:

                                Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

                                K Offline
                                K Offline
                                kalberts
                                wrote on last edited by
                                #18

                                When structured languages (like Algol, Pascal etc) came onto the scene, we used to say that "You can program FORTRAN in any language". Around 1980. a professor in the Mecanical Engineering Department and eager FORTRAN coder wrote an article for the newsletter from the University Computing Center, with a fierce attack on this silly idea of indenting loops and conditional blocks (when programming in these new languages). Like in a book: All text is left justified, starting at the margin. You can't make it consistent anyway, if you, say, have a labeled statement in that indented part: Any jump to that label would break the idea of this indented block being a coherent unit... Or something like that. I believe I still have that newsletter in my archives. I really should dig it up to see if he had any valid arguments at all. He probably didn't. I can't imagine what they would be.

                                G 1 Reply Last reply
                                0
                                • N Nish Nishant

                                  There may be reasons to dislike C++, but surely this one is a programmer induced problem. :~

                                  Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com

                                  K Offline
                                  K Offline
                                  kalberts
                                  wrote on last edited by
                                  #19

                                  One reason to dislike C(++) is that it provides excellent tools for a programmer to make a mess in a very simple way. In the earlier days, you could see quite a few horrible cases of poiner arithmetic - and the programmers were proud of it, proud of how they could do things that were impossible in toy languages like Pascal that gave you a slap on your fingers for just addressing outside the array limits, and introducing artificial differences between a pointer to the start of an array and the array itself. Every knowledgeabler person should know that they are the same! Fortunately, intricate pointer arithmetic is no longer the way to prove your skills. OO techniques has been more popular for that for at least 15-20 years. Virtual functions and overrides may be terribly abused, too, and what is the big difference bewtween operator overloading and virtual functions, at the conceptual level?

                                  M 1 Reply Last reply
                                  0
                                  • R Rage

                                    OriginalGriff wrote:

                                    if you try hard.

                                    And the lazies use VB.

                                    Do not escape reality : improve reality !

                                    K Offline
                                    K Offline
                                    kalberts
                                    wrote on last edited by
                                    #20

                                    I remember "PEEK(address)" and "POKE address, value" as dearly loved functions, but that was in the DOS days. If my memory is correct, it never made it into Visual Basic, though. (I guess it would be more or less meaningless, too, considering the memory management of Windows.)

                                    1 Reply Last reply
                                    0
                                    • T TheGreatAndPowerfulOz

                                      What you should really be hating on is the abhorrent coder not the language. That's like hating the hammer that was used to build the crappy shack you live in.

                                      #SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                                      M Offline
                                      M Offline
                                      Munchies_Matt
                                      wrote on last edited by
                                      #21

                                      Oh I do, dont worry, but C++ allows this kind of crap to happen.

                                      T 1 Reply Last reply
                                      0
                                      • M Munchies_Matt

                                        Oh I do, dont worry, but C++ allows this kind of crap to happen.

                                        T Offline
                                        T Offline
                                        TheGreatAndPowerfulOz
                                        wrote on last edited by
                                        #22

                                        so does every other language that is of any use beyond kiddie crap.

                                        #SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                                        M 1 Reply Last reply
                                        0
                                        • T TheGreatAndPowerfulOz

                                          so does every other language that is of any use beyond kiddie crap.

                                          #SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                                          M Offline
                                          M Offline
                                          Munchies_Matt
                                          wrote on last edited by
                                          #23

                                          C++ positively invite this kind of ridiculousness. Give a man a hammer, and everything is a nail. Give a language feature x and every one has to abuse it. C++ has more of these than any other language I have used, ADA, VB, Java, Small Talk, Prolog and of course C, way more.

                                          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