• HaraldvonBlauzahn@feddit.org
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    6 hours ago

    All the complaints I’ve mentioned—from awkward names and slow containers to the static zoo and invisible copies—ultimately lead to the same conclusion. People think C++ puts performance above everything else, but in reality, its highest priority is backward compatibility. Performance comes second; developer ergonomics come second; the overall programming experience comes second. Everything comes second.

    That commitment to compatibility is exactly what turned the language into the abomination it is today. You can’t rename vector because it would break billions of code lines. You can’t make unordered_map significantly faster because it would change the ABI. And you certainly can’t introduce destructive move semantics—the opportunity passed more than a decade ago, and breaking existing code is simply off the table. Every wart in the language is a fossilized consequence of some long-forgotten design decision. You can’t remove it because something already depends on it: someone’s library, game engine, application, or entire build pipeline.

    Ironically, the very thing people criticize C++ for is also the reason it powers such a large part of software over the world. Backward compatibility is both the language’s greatest flaw and the key to its survival. Code you wrote twenty years ago will often still compile today—with a bit of tweaking and the occasional ritual sacrifice. Even an abandoned library from 2008 can link to a modern application.

    I only partly agree. I think that backward compaltibility and ugliness and complexity are not necessarily connected. Take Common Lisp, which is one year older than C++. Common Lisp has better backward compatibility than C++, a large, completely standardized Library, quite performant implementations some which generate native code, and, while it is certainly a large language, it it still is much simpler and the had very little changes, so that 35 year old programs will work without problems.

    And the successors, which are the Schemes, also have good implementations - for example Guile - , and when using an implementation that can link with the C ABI (like Guile), is a really nice complement to Rust. In fact, just as Python and C, they can make a nice (and much more modern) combo for rapid prototyping and performance-oriented compiled language.

  • onlinepersona@programming.dev
    link
    fedilink
    English
    arrow-up
    28
    arrow-down
    3
    ·
    6 days ago

    So yes, C++ is a terrible language. Now fire up your terrible IDE and get back to coding in the worst programming language in the entire world!

    No thank you. I’ve moved on long ago and welcome the abilities that rust provides. Since I’m not a game developer who needs to “move fast and break things”, which C++ is not even good at btw (well the moving fast part), there is no reason to use or get accommodated with C++ again. I think I’d even rather write PHP than C++ at this point.

    • MyNameIsRichard@lemmy.ml
      link
      fedilink
      arrow-up
      32
      ·
      6 days ago

      I think I’d even rather write PHP than C++ at this point.

      You can get professional help for that these days!

      • spartanatreyu@programming.dev
        link
        fedilink
        arrow-up
        9
        ·
        5 days ago

        Modern PHP is basically a different language than the horrors of php 3-4.

        It has:

        • traits
        • pattern matching
        • named parameters (so you never have to pass in a null anywhere just to skip a parameter in a function that someone else defined)
        • references (like smart pointers so you can pass by reference instead of value, but it prevents you from seeing the actual memory address to stop people trying to do math on pointers and ending up with bugs)
        • SensitiveParameter (a way to make a value as this needs to be hidden for security purposes, so attackers can’t leak passwords in stack traces by causing crashes)
        • etc…

        That said, there’s still some remnants of the horrors…

        • Its god awful API.
          • Example, if you wanted to do something with a string, you can’t type the string then . and see a list of functions/methods to use on it. Nor can you call a general String. and see autocompleted things. No, instead every single method that is used for string manipulation has a different name that doesn’t include the word string at all. And the names are completely inconsistent. You just have to memorise an entire textbook of invocations to do the one simple thing you want to do.
          • There was work to fix the naming inconsistency, but the proposal’s been dead for years. If you want to see the horrors it would have fixed you can check: https://wiki.php.net/rfc/consistent_function_names#list_of_functions_to_be_renamed
        • Way too much OOP
          • Want to make a simple data structure? Too bad, type out 100 lines and make an object instead.
          • There’s just way too much boiler plate.
    • StrikeForceZero@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      4 days ago

      Bevy makes game dev with rust a dream IMO. Just missing a full blown editor like Godot has. So for me I haven’t found a situation where I wouldn’t use rust lol

    • RaphaelSchmitz@feddit.org
      link
      fedilink
      arrow-up
      5
      ·
      4 days ago

      The “move fast and break things” is from Silicon valley startup culture. Like, JS and PHP. No idea why you would think C++ is the poster child for fast iteration.

      • flying_sheep@lemmy.ml
        link
        fedilink
        arrow-up
        5
        arrow-down
        1
        ·
        4 days ago

        Because that’s the main reason people cite why they’re not programming games in Rust.

        There has to be something to it as well, because it happened a few times, while people keep falling in love with Rust in all other fields

        • ulterno@programming.dev
          link
          fedilink
          English
          arrow-up
          2
          ·
          4 days ago

          The reason for that was probably because they were more well versed with C++ and learning Rust would require extra time and also that back then there were not enough frameworks, libraries and game engines available with Rust.
          I see quite a few games being made using Rust nowadays thanks to increased availability.

    • spartanatreyu@programming.dev
      link
      fedilink
      arrow-up
      6
      ·
      5 days ago

      But… JavaScript also exists so like… ?

      Yeah, but JS is more of a compile target than a language now since most JS devs are really TS devs.

      Also, JS (the language) has some killer features, like executing while still downloading, and rock solid backwards compatibility.