I rather write garage code than using slop

  • dfyx@piefed.social
    link
    fedilink
    English
    arrow-up
    9
    arrow-down
    1
    ·
    9 hours ago

    I would say the main downside of C++ is that it carries around a lot of baggage from the last 40 years. Even if you decide to use a modern standard in your own code, you’ll have to deal with libraries that can’t use many of the new features because they need to stay backwards compatible with old code bases. Also, a lot of tutorials and examples still look like they are from pre-C++11 times.

    I recently started a project that would have been a great fit for C++ (simple 2D game engine + editor) but the way Qt has to reinvent half the standard library, GTK basically asks you to write plain C and gtkmm had some other issues that I can’t even remember, all the fun of working on the project was gone. I decided to switch to C# (which I use for work anyway) and Avalonia and so far it’s going well. Not being able to use C++ still nags at me anyway. I would have loved to get more comfortable with modern C++ but I just couldn’t keep up the motivation.

    I’ll try again for the next project.

    • diaphragmwp@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      8 hours ago

      carries around a lot of baggage from the last 40 years

      cries in C stdlib

      I hate null terminated strings. Though the rest of just C without the “pluses” is nice. Nobody really kept adding new things unlike in C++, it’s just mostly the good old stuff.

      Anyways

      GTK basically asks you to write plain C

      From my perspective, glib is all possible languages at once implemented as C macros. What you are actually writing is technically valid C, but I would consider it “glib language” lmao.

    • ImgurRefugee114@reddthat.com
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      4 hours ago

      it carries around a lot of baggage from the last 40 years.

      Cppfront2 is an interesting experiment that looks at an approach to solve that problem without a hard break. While my C nostalgia is offended by the syntax, I’m quite fond of it. Bjarne’s pet topic of ‘profiles’ is another but hasn’t landed much yet.

    • unknownuserunknownlocation@kbin.earth
      link
      fedilink
      arrow-up
      3
      arrow-down
      1
      ·
      8 hours ago

      Agree on that. It cuts both ways. On the one hand, it gives you access to a fuckton of libraries so that you can chose the one that best fits your use case. On the other hand a lot of those libraries don’t use modern C++. And I haven’t even started on things like the win32 API, which is essentially a C library masquerading as a C++ API.

      That’s essentially the thing with C++: when you’re chosing which library to use, the level of C++ should be a factor in the decision making process, along with things like performance and functionality. And if I do end up using a library that was written for an old C++ version, I create wrappers for the things I use the most to bring it to the level of C++ I’m working with. Sometimes it’s also interesting purely from a learning perspective. That’s what I did for a lot of the win32 APIs I worked with.

      You mentioned tutorials - I learned C++ from learncpp.com, and I couldn’t recommend it more. It does a really good job at going deep into the technical stuff, but also understanding and using the most modern features of the language, as well as best practices.