• Zacryon@feddit.org
    link
    fedilink
    arrow-up
    4
    ·
    1 day ago

    I don’t like that “C++ isn’t memory safe”. It is. Users of that language are usually just not experienced or educated enough and therefore more mistakes happen.

    I agree though, that other languages like Rust or Java can make it easier to prevent such mistakes.

    In my experience, using smart pointers alone already solves 90% of memory issues I have to deal with. C++ improved a lot in that regard over the decades.

    • lolcatnip@reddthat.com
      link
      fedilink
      English
      arrow-up
      7
      ·
      edit-2
      1 day ago

      I’m very experienced with C++and I still feel like I’m juggling chainsaws every time I use it. And I’ve personally run into into things like use after free errors while working in Chromium. It’s a massive codebase full of multithreading, callbacks, and nonlocal effects. Managing memory may be easy in a simple codebase but it’s a nightmare in Chromium. Tools like AddressSanitizer are a routine part of Chrome development for exactly that reason. And people who think memory management is easy in C++ are precisely the people I expect to introduce a lot of bugs.

      • Zacryon@feddit.org
        link
        fedilink
        arrow-up
        1
        ·
        1 day ago

        I’ve a very long track record using C++ as well and I can’t share the feeling. I don’t say it’s alyways easy. I’m just saying that it’s doable and therefore whether the software is memory safe depends on the expertise of the devs. Modern C++ practises, programming patterns and as well tools from the STL (or even your own implementation) make life a lot easier. If you don’t use them, that’s not the languages fault. In the end, how you use the language still matters a lot. If you’d like to think less about memory management, go on and use Rust or C# or Java or even Python if performance doesn’t matter. That’s perfectly fine. This can come with other issues, like more boilerplate in the case of Rust for example, but in the end those languages are tools. Choose the tool which gets your job done.

        • WhyJiffie@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          1
          ·
          13 hours ago

          I don’t think this solely depends on the level of experience. People make mistakes, and these kinds of mistakes are very hard to find. And don’t tell me you are the perfect coder that makes no mistakes, introduces no bugs.

        • lolcatnip@reddthat.com
          link
          fedilink
          English
          arrow-up
          3
          ·
          edit-2
          20 hours ago

          whether the software is memory safe depends on the expertise of the devs

          No. Just stop. If a language depends on the expertise of the developer to be free of memory bugs, then by definition, it is not memory safe because memory safety means such bugs are impossible by design. Quit trying to redefine what memory safety means. A program being free of memory bugs does not in any way imply memory safety.

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

      The good news is that the browser comes from Serenity OS which means it probably is lightweight and well written.