• Feyd@programming.dev
    link
    fedilink
    arrow-up
    12
    ·
    5 hours ago

    C++ is my favorite language I’ve ever programmed in and is not even close, but I spent way too much of my time on code reviews because I couldn’t trust almost anyone I worked with not to create dangling refs, memory leaks, etc

  • SinTan1729@programming.dev
    link
    fedilink
    English
    arrow-up
    41
    ·
    edit-2
    10 hours ago

    My first ever big boy language was C++ (after Basic, and Logo, does anyone remember that lol). I was in middle school, tried to self-learn from learncpp.com, only to realize that I had mostly learned C, with cin-cout instead of printf-scanf. So I just decided to migrate to C. Nowadays, I mostly code in Rust, Go, and Python. But my experience with C has been extremely helpful. Can’t say the same about C++ though.

      • pinball_wizard@lemmy.zip
        link
        fedilink
        arrow-up
        2
        ·
        2 hours ago

        Yay, Logo

        Seriously, three cheers for Logo!

        Incidentally, I’ve found that import turtle in interactive Python opens a pretty good logo clone on most operating systems.

        • ChaoticNeutralCzech@feddit.org
          link
          fedilink
          English
          arrow-up
          3
          ·
          edit-2
          3 hours ago

          I used Imagine by Logotron (Czech-localized, including keywords - yes, with diacritics) as my IDE, and I still have it installed because the accompanying graphics editor (LogoMotion) is just so good. I never got to the OOP part because the textbook didn’t cover it and there are no materials onlone about the Czech version (not even a keyword dictionary), and I couldn’t speak English back then. I stopped programming for way too long because I couldn’t get another IDE working and I didn’t know how to make arrays and text I/O in Logo, the tutorials I had stopped at variables.

    • LedgeDrop@lemmy.zip
      link
      fedilink
      arrow-up
      17
      ·
      9 hours ago

      C++ is useful for learning object oriented programming: Describing what really happens in constructors and destructors, the pros/cons of reference counting and how it actually works (using std::unique_ptr)

      These are things that most modern languages try to hide/abstract away, but the underlying problems and limitations never go away, but with C++ you’ll have a better understanding of why they happen.

      However, if you go down the rabbit hole of Template Metaprogramming, I agree with the original post: it takes decades to learn and really only useful exploitable in C++.

      • YaBoyMax@programming.dev
        link
        fedilink
        English
        arrow-up
        2
        ·
        4 hours ago

        I don’t disagree that the language is a great way to build an understanding of object lifecycles, but in my experience C++ ctors and dtors are also the biggest source of confusing footguns I’ve ever encountered in any programming language.

        Separately, template metaprogramming is a whole different beast. It’s an extremely powerful tool, but to me it also feels like finding the correct incantation to get it to do exactly what you need for more complex scenarios. It can be really fun if you know what you’re doing, but it also tends to make me very upset at the compiler when my incantations are a bit off.

      • Feyd@programming.dev
        link
        fedilink
        arrow-up
        3
        ·
        7 hours ago

        How does unique_ptr teach reference counting? It’s just a way to interface with RAII and move semantics

        • LedgeDrop@lemmy.zip
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          3 hours ago

          You’re right. I was thinking of shared_ptr (it’s been a blissful long while since I’ve dived deep into C++ stl and boost)

          edit: a word

      • SinTan1729@programming.dev
        link
        fedilink
        English
        arrow-up
        3
        ·
        8 hours ago

        I’ve always preferred the functional approach to programming, so OOP never really intrigued me. That’s one of the reasons why I never liked C++ or Java, but instantly fell in love with Rust. It lets me do a lot of functional style programming, while still being somewhat practical. (I’m looking at you, Haskell.)

        • LedgeDrop@lemmy.zip
          link
          fedilink
          arrow-up
          2
          ·
          3 hours ago

          I’ve been a long time believer that some problems are better solved via OOP, others through functional programming. The perfect language would be a successful blend of the two.

          Many popular OOP languages are horribly lacking on FP or it looks like an eyesore (golang, python, etc). …and FP languages trying to do OOP are kinda awkwards (see common-lisp).

          I thought Crystal Lang (a statically type checked dialect of Ruby) was going to be the “perfect language”… but the compile time performance and the lack of 3rd party libraries (like an aws SDK) really made it hard to use.

          Hearing what you said about Rust has renewed my hope.

          That said, I did notice that features like Coroutines have been “experimental” for nearly 9 years.

          I hope I’m missing something obvious, but how would you create any sort of heavy-lifting, long running, multi-session daemon/application without having some sort of asynchronous mechanism that goes beyond threading (which is limited to the number of cores the host machine is running).

          edit: cleaned up a few thoughts (prematurely hit submit)

          • SinTan1729@programming.dev
            link
            fedilink
            English
            arrow-up
            1
            ·
            edit-2
            1 hour ago

            I don’t think there’s an std-way of doing it, but the Rust ecosystem has this thing where people usually settle around one library. In this case, it is tokio. Afaik, most async stuff is done using tokio. What little async I’ve used, it’s been using tokio or some library like actix-web that uses tokio under the hood.

            Also, side note, I never understood the idea of why golang is ugly. I think it’s fine, except for maybe the repeated if err != nil guards. Those are ugly. I wish it used additive types for error handling.

        • copacetic@discuss.tchncs.de
          link
          fedilink
          English
          arrow-up
          3
          ·
          7 hours ago

          Quite a while ago, I wrote this to document my understanding what OOP actually is.

          This sentence at the end is interesting:

          On the other hand it sounds unlikely that there will be a popular language without object-oriented influences some day, so at least minimal syntax-level support is desirable.

          Rust was published like one year later and it can be considered popular by now. Does Rust support OOP via traits? Kind of yes, but so does Haskell with typeclasses.

  • xav@programming.dev
    link
    fedilink
    arrow-up
    78
    arrow-down
    1
    ·
    13 hours ago

    I have decades of C++ experience. I have never met any C++ developer who hasn’t shot himself in the foot regularly with this damn language.

      • naeap@sopuli.xyz
        link
        fedilink
        arrow-up
        6
        arrow-down
        1
        ·
        7 hours ago

        And I fucking love it

        I hate java with a passion, C# was fun (but at that time only available through the .Net nightmare) and I grew up with (Turbo ;⁠-⁠)) Pascal and C

        So, I’m feeling rather comfortable and at home with C++

        I’d like to do a bigger project in Rust once at least, but with my current project already the compile times are between 20/25 to 45mins (depends, if you have the build server available or if you need to make up with the IPC).
        so, I guess, those iterations would become even longer with Rust

        But I’m also having the advantage, that my applications are running very, very isolated. So I don’t really need to take care about exposure and attacks.

        Still… Finding a memory leak or some shared memory fuck up is everything but fun…

        Especially as most of the logic runs in kernel space and debugging possibilities are mostly reduced to traces/log files

        Still, I love it
        Maybe it’s because of the thrill ;⁠-⁠)

    • Valmond@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      37
      ·
      13 hours ago

      But it’s the funniest language IMO, you can do frigging anything with it.

      Which is why it causes problems of course.

    • SaharaMaleikuhm@feddit.org
      link
      fedilink
      arrow-up
      1
      ·
      6 hours ago

      Haha, I hate the language. But as long as I don’t randomly want to use the Unreal Engine it’s really easy to avoid it

  • red_tomato@lemmy.world
    link
    fedilink
    arrow-up
    49
    ·
    14 hours ago

    The problem with C++ is that it has so many odd quirks that are difficult to learn. Sometimes these quirks are addressed - at the expense of adding new stupid quirks you need to learn.

  • dragnucs@lemmy.ml
    link
    fedilink
    arrow-up
    8
    ·
    11 hours ago

    There is a difference between learning a language and be productive with it, and with mastering a language. Being a good software developer is another thing.

  • copacetic@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    14
    ·
    13 hours ago

    To be clear, the language itself is usually not the big part. You also have to learn the eco-system, libraries, packaging, debugging, etc.

    (C++ is still a very “comprehensive” language though)

  • mercano@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    13 hours ago

    C and C++ ask the programmer to deal with things themselves that other more modern languages do for you in the language runtime Memory management would be the big one. It’s more to wrap your head around, but if you can do it, there’s potential for more performance. In my mind, it comes down to a trade off between development time versus CPU time, and CPU time is a lot cheaper these days.

    Signed, a Java dev

  • xav@programming.dev
    link
    fedilink
    arrow-up
    7
    arrow-down
    5
    ·
    11 hours ago

    I have decades of C++ experience. I have never met any C++ developer who hasn’t shot himself in the foot regularly with this damn language.

    • anon_8675309@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      8 hours ago

      Developers are the problem. They get language feature envy and so the language they use gets pushed to include the new feature. It’s why a lot of devs hate languages like Go because Go is highly resistant to change. So languages like C++ and C# end up with so many features you can’t possibly know or master all of them.

      For some fucking reason devs don’t want to use multiple languages.

  • SinTan1729@programming.dev
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    2
    ·
    11 hours ago

    My first ever big boy language was C++ (after Basic, and Logo). I was in middle school, tried to self-learn from learncpp.com, only to realize that I had mostly learned C, with cin-cout instead of printf/scanf. So I just decided to migrate to C. Nowadays, I mostly code in Rust, Go, and Python. But my experience with C has been extremely helpful. Can’t say the same about C++ though.

  • lacethespace@sh.itjust.works
    link
    fedilink
    arrow-up
    3
    ·
    12 hours ago

    I spent few years using it professionally and mentoring others, but never felt comfortable with it. Small eternities spent fighting the language constructs and solving typing puzzles. My take away is that I could just barely fit the C++ in my head and then there’s no room for anything else. I’m done with it for good.

  • xav@programming.dev
    link
    fedilink
    arrow-up
    4
    arrow-down
    10
    ·
    13 hours ago

    I have decades of C++ experience. I have never met any C++ developer who hasn’t shot himself in the foot regularly with this damn language.