• letsgo@lemm.ee
    link
    fedilink
    English
    arrow-up
    45
    ·
    2 days ago

    I find the easiest way to forget C++ is to try watching CppCon on YouTube.

    I’ve been doing C++ professionally since 1991.

    But when I watch CppCon, what the hell are they gabbling on about? It’s all complete gobbledegook! They may as well be speaking in an ancient Goa’uld dialect for all the sense it makes. These people are so far down a rabbithole I start to wonder if they’ve ever seen the surface.

    I am therefore forced to the conclusion that despite 34 years of experience in C++ I don’t know C++.

    • gadfly1999@lemm.ee
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      15 hours ago

      I work with Qt and that framework has preferences for avoiding a lot of modern C++. I generally agree that it makes better code.

      Also, I started with C++ in like 1992 and some part of me still feels like templates are newfangled nonsense.

    • collapse_already@lemmy.ml
      link
      fedilink
      English
      arrow-up
      3
      ·
      22 hours ago

      So glad I am not the only one. It doesn’t help that I work on various projects, some of which use really old compilers. Tried using make_shared the other day and the compiler was not having any of it. Triple checked my syntax and spelling three times before realizing that the compiler was too old to support it.

    • Jankatarch@lemmy.world
      link
      fedilink
      arrow-up
      9
      ·
      edit-2
      23 hours ago

      Any technique is bad if you force the programmer to use only that.

      I like C++ and python over java there. I don’t need to make a public static singleton class called “IsEven.”

    • ByteOnBikes@slrpnk.net
      link
      fedilink
      arrow-up
      7
      ·
      edit-2
      1 day ago

      Nah. It’s just a paradigm. I hated it when I studied it in the 2000s, and have gained some appreciation of it 20 years later.

      What I realized isn’t that I hate OOP, moreso I hate how old ass books/old guard developers used OOP.

      Could also be related to c++

      • adhocfungus@midwest.social
        link
        fedilink
        arrow-up
        9
        ·
        2 days ago

        I used to love C++ and I still do to some extent. But the longer I am away from it the more I realize it was largely just Stockholm syndrome.

        • 5C5C5C@programming.dev
          link
          fedilink
          arrow-up
          8
          ·
          1 day ago

          C++ was far and away my favorite language (I used it professionally for 10 years and was always excitedly keeping up with new ISO developments), until I learned the basics of Rust…

          Now it’s my firm belief that the world will become a better place when C++ stops existing. C++ just has no positive role to play in a world where Rust exists at the level of maturity that it already has.

          Whatever they might try to do to C++ to make it less intolerable will be in vain until they’re ready to break backwards compatibility. And once they’re willing to break backwards compatibility to legitimately improve the language, they’re just going to end up with a messy knock off of Rust.

          • paperplane@lemmy.world
            link
            fedilink
            arrow-up
            6
            ·
            1 day ago

            As long as you limit yourself to a subset of modern C++, it’s actually a decent language. Less guardrails than Rust, but more syntactic sugar (think overloading, default parameters, implicit this, implicit reference-taking, implicit conversions). You could argue those are anti-features, but even as someone who really likes Rust, I gotta admit C++ is occasionally more ergonomic.

            • 5C5C5C@programming.dev
              link
              fedilink
              arrow-up
              3
              ·
              1 day ago

              Even with modern C++ it’s loaded with seg fault and undefined behavior footguns.

              The times when C++ feels more ergonomic than Rust are the times when you’re writing unsafe code and there’s undefined behavior lurking in there, waiting to ambush you once you’ve sent it to production. Code that is 100% guaranteed safe is always, and I really want to emphasize this: always more ergonomic to write in Rust than it is to write in C++.

              Show me any case where C++ code seems more ergonomic than its Rust equivalent, and I will always be able to show you how either the C++ code has a bug hiding in it or how the Rust code can be revised with syntactic sugar to be more ergonomic than the C++.

              • paperplane@lemmy.world
                link
                fedilink
                arrow-up
                2
                ·
                1 day ago

                Having the ability to overload functions or constructors without a million Stuff::with_x variants is something I consider more ergonomic and not unsafe. I know the Rust community prefers explicitness in many places, but explicitness and safety are somewhat orthogonal in language design. I consider e.g. Swift to be a safe and ergonomic/sugared language, that borrows, no pun intended, a lot of ideas from Rust

                • 5C5C5C@programming.dev
                  link
                  fedilink
                  arrow-up
                  3
                  ·
                  15 hours ago

                  There are several ways to achieve an effect equivalent to operator overloading in Rust, depending on exactly how you want the overloading to work.

                  The most common is

                  fn do_something(arg: impl Into<Args>) {
                      ...
                  }
                  

                  This lets you pass in anything into the function that can be converted into the Args type. If you define the Args type yourself then you can also define any conversion that you want, and you can make any construction method you want for it. It’s a small touch more explicit than C++'s operator overloading, but I think it pays off overall because you know exactly what function implementation all different choices of arguments will be funneling into.

                  I’ll admit there’s one thing from C++ that I frequently wish were available in Rust: specialization. Generics in Rust aren’t exactly the same as templates in C++ but they’re close enough that the concept of specialization could apply to traits and generics. There is ongoing work to bring specialization into the language, but it’s taking a long time, and one of my projects in particular would seriously benefit from them being available.

                  Still, Rust will have specialization support long before C++ has caught up to even a quarter of the benefits that Rust has over it.

      • Redkey@programming.dev
        link
        fedilink
        arrow-up
        4
        ·
        edit-2
        1 day ago

        I don’t think that even C++ is that bad. Like a lot of shows and music acts, I think it’s more the toxic fan base than the thing itself that really sucks. I’ve had the same feeling with a certain kind of JavaScript programmer.

        *Edit for clarity: I’m not saying that the entire C++ community is toxic, just a vocal segment of it, in line with the other examples I gave.

        The added difficulty with this in programming is that it can be much harder simply to ignore them, because you may be forced to work with them, or stuck needing to learn something from them (shudder).

        • hopesdead@startrek.website
          link
          fedilink
          arrow-up
          5
          ·
          2 days ago

          I took one college course and couldn’t handle it. On top of that I was the weird student that wanted to use a Mac instead of the school’s own computers. So anytime I had a problem, the teacher would just blame me using Xcode instead of Visual Studio.