• LaggyKar
    link
    fedilink
    arrow-up
    35
    arrow-down
    2
    ·
    10 小时前

    This is something that Rust is specifically designed to prevent.

    • CanadaPlus@lemmy.sdf.org
      link
      fedilink
      arrow-up
      3
      ·
      4 小时前

      C/C++ is mildly obsolete now, basically. Breaking the memory model is not really a small defect that’s a matter of taste.

    • kiri@ani.socialOP
      link
      fedilink
      arrow-up
      4
      arrow-down
      1
      ·
      10 小时前

      There are C++ analyzers like this which are also designed to prevent it (if you have no choice between languages).

      • CanadaPlus@lemmy.sdf.org
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        3 小时前

        I’ve seen things like this posted several times on here. It always turns out it doesn’t actually catch all the possible problems, or it’s garbage collected, or it’s non-usable for real code.

        If it was that easy, the people who wrote Rust with all it’s complexity and divergence from the norm were idiots, and I really don’t think they were.

        • kiri@ani.socialOP
          link
          fedilink
          arrow-up
          3
          ·
          3 小时前

          It’s pleasure for me to write in rust, I really like how fast I can deploy a working solution (including debug time). As I mentioned, there are situations when, for some reason, you cannot do without C++. But you are right cpp-analyzers do not solve all possible problems.

    • Lemmist@lemm.ee
      link
      fedilink
      arrow-up
      8
      arrow-down
      18
      ·
      10 小时前

      Prevent what? UNDERSTANDING the code?

      Yeah, Rust is quite successful in that :)

      • CanadaPlus@lemmy.sdf.org
        link
        fedilink
        arrow-up
        1
        ·
        3 小时前

        I feel like a really bad job has been done of making it simple, honestly. Or at least was last I checked.

        Pointers allow aliasing XOR mutability. There’s all kinds of nuance layered on top of that if you look in the compiler developers resources, but that’s just to allow for all the different kinds of sugar people want in a modern language.

      • bitcrafter
        link
        fedilink
        arrow-up
        4
        arrow-down
        1
        ·
        5 小时前

        You do not come across as clever as you think that you are when your central point is that you personally are not capable of understanding code written in a different programming language.

        • Lemmist@lemm.ee
          link
          fedilink
          arrow-up
          4
          arrow-down
          11
          ·
          10 小时前

          That’s a rather old joke. Modern compilers print more adequate things on STL/templates related things.

          And it doesn’t make Rust any better.

          • kiri@ani.socialOP
            link
            fedilink
            arrow-up
            6
            ·
            8 小时前

            Yeah, I know, that all just a humour. I almost always use C++, inspite of knowing rust (cz no jun vacncies for rust, but still). There is no modern language which is absolutely better than other one — compromises are everywhere, that’s why it’s a silly topic to argue about.