I rather write garage code than using slop

  • Possibly linux@lemmy.zip
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    1
    ·
    7 hours ago

    C++ is a lot of things but elegant and safe are not words that come to mind. C++ has far more issues than regular C.

    Best option would be to use something with memory safety

    • observantTrapezium@lemmy.ca
      link
      fedilink
      arrow-up
      2
      ·
      6 hours ago

      Well, I mentioned safe in the comparative degree. Modern C++ could be actually safe if you restrict yourself to a subset of it, that’s sometimes not really practical. I do think that things are improving and with C++26 it’s becoming way easier to write perfectly (memory-)safe code that’s also (subjectively) elegant.

      • Possibly linux@lemmy.zip
        link
        fedilink
        English
        arrow-up
        1
        ·
        6 hours ago

        The C++ spec is absolutely massive. Nothing says elegant like a million different ways to do something.

        Python works pretty well and doesn’t have to much overhead. Sure it doesn’t have the same performance as C/C++ or Rust but most of the time you don’t need millisecond level code.

        • observantTrapezium@lemmy.ca
          link
          fedilink
          arrow-up
          1
          ·
          4 hours ago

          I do agree and I think it’s wise to narrow C++ down by a lot, and that is a choice you can make when working on a new project.

    • Supercrunchy@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      6 hours ago

      Modern C++ changed a lot!

      You are supposed to use shared_ptr (automatic reference counted pointer) and unique_ptr(statically checked unique pointer) and not create raw C-style pointers anymore. It still has a lot of weird niche cases that need to be avoided, but memory management is definitely much easier, so in many ways it’s safer at runtime than C, while being still much more obscure than C.

      I still agree with you that a more modern language would be even better, especially for learning!