• kSPvhmTOlwvMd7Y7E@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    2 months ago

    I don’t understand why this is called a “subset”, while clearly containing new syntax

    A subset would be understood by older compilers, this is a superset

    • Tamo240@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      2 months ago

      The goal of this proposal is to advance a superset of C++ with a rigorously safe subset.

      The subset is of the proposed syntax superset. Reason being because the superset also contains explicitly unsafe syntax similar to rust.

  • funtrek@discuss.tchncs.de
    link
    fedilink
    arrow-up
    0
    ·
    2 months ago

    The problem with c++ is that it allows people to do whatever they want. Turns out: people are dumb. Rust solved that problem. Nothing more, nothing less.

    • _____@lemm.ee
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 months ago

      I heavily disagree. C++ has a lot of problems but it’s flexibility is not one of them.

      Imo the biggest problem with C++ is that there are a dozens ways of doing the same thing. The std lib is not general and fast enough for everyone. Therefore it’s not even “standard” .

      I have seen many conferences of a proposed “cpp2” like syntax that breaks abi but imo it’s the best way forward.

      • FizzyOrange@programming.dev
        link
        fedilink
        arrow-up
        0
        ·
        2 months ago

        Yeah but I have written a lot of Rust and I have yet to use a single unsafe block.

        Saying “but… unsafe!” is like saying Python isn’t memory safe because it has ctypes, or Go isn’t memory safe because of its unsafe package.

        • FalconMirage@jlai.lu
          link
          fedilink
          arrow-up
          1
          ·
          2 months ago

          You don’t have to use unsafe C++ functions either

          C++ is technically safe if you follow best practices

          The issue, to me, is that people learn older versions of the language first, and aren’t aware of the better ways of doing stuff.

          IMO people should learn the latest C++ version first, and only look at the older types of implementation when they come across them

          • FizzyOrange@programming.dev
            link
            fedilink
            arrow-up
            0
            ·
            2 months ago

            C++ is technically safe if you follow best practices

            Yeah but it’s virtually impossible to reliably follow best practices. The compiler won’t tell you when you’re invoking UB and there is a lot of potential UB in C++.

            So in practice it is not at all safe.

            • FalconMirage@jlai.lu
              link
              fedilink
              arrow-up
              1
              ·
              2 months ago

              I agree

              I was only adding my opinion (that people should try to always use the latest version of C++, which is inherently safer, but still not 100% safe)

  • lysdexic@programming.devM
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    2 months ago

    From the article.

    Josh Aas, co-founder and executive director of the Internet Security Research Group (ISRG), which oversees a memory safety initiative called Prossimo, last year told The Register that while it’s theoretically possible to write memory-safe C++, that’s not happening in real-world scenarios because C++ was not designed from the ground up for memory safety.

    That baseless claim doesn’t pass the smell check. Just because a feature was not rolled out in the mid-90s would that mean that it’s not available today? Utter nonsense.

    If your paycheck is highly dependent on pushing a specific tool, of course you have a vested interest in diving head-first in a denial pool.

    But cargo cult mentality is here to stay.

    • scratchee@feddit.uk
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      2 months ago

      I think your take is a bit extreme.

      Currently their statement (regardless of the questionable justification) is largely correct, no major c++ projects have been written in a safe subset and no real work has really started yet. It isn’t practical.

      I do agree with you that a safe form of c++, once fully implemented and not frustrating to use, could easily become viable, the feature can be added. But that’s still years away from practical usage in large project, and even when done, many projects will stick to the older forms, making the transition slow and frustrating.

      The practical result is that he’s sort of right, if you just add the word “currently” to his statement.

      Otoh, I do agree with you that rust cannot be the sole answer to this problem either, it’s almost as impractical to rewrite codebases in rust as an as-yet unfinished safe form of C++. Only time and lots of effort can fix this problem

    • nous@programming.dev
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 months ago

      Just because a feature was not rolled out in the mid-90s would that mean that it’s not available today?

      Adding a feature is one thing, C++ has added a lot of memory safety features over the years. The problem with C++ is it still allows a lot of unsafe ways of working with memory that previous projects used and people still use now. Removing support for these features will break existing code and piss a lot of people off in the process. It is not about adding new features, but removing the unsafe existing features that they are talking about here.

      • lysdexic@programming.devM
        link
        fedilink
        English
        arrow-up
        0
        ·
        2 months ago

        The problem with C++ is it still allows a lot of unsafe ways of working with memory that previous projects used and people still use now.

        Why do you think this is a problem? We have a tool that gives everyone the freedom to manage resources the way it suits their own needs. It even went as far as explicitly supporting garbage collectors right up to C++23. Some frameworks adopted and enforced their own memory management systems, such as Qt.

        Tell me, exactly why do you think this is a problem?

          • FizzyOrange@programming.dev
            link
            fedilink
            arrow-up
            0
            ·
            2 months ago

            It’s not just that. Debugging segfaults and UB can be an absolute nightmare.

            The C++ committee still haven’t learnt their lesson. I recently learnt about C++20 coroutines, which are pretty neat, if complex (there are pretty much no good learning resources about them). However they are still putting unnecessary UB footguns in it.

            • lad@programming.dev
              link
              fedilink
              English
              arrow-up
              0
              ·
              2 months ago

              Reminds me of how I found some safety measures to be in China some years back, basically those were signs saying “plz don’t fall to your death, if you do it’s your fault”

              • lambalicious@lemmy.sdf.org
                link
                fedilink
                English
                arrow-up
                1
                ·
                2 months ago

                At least it’s not like Russia, where it’s “plz don’t fall to your death, if you do it’s our fault”…

                • lad@programming.dev
                  link
                  fedilink
                  English
                  arrow-up
                  2
                  ·
                  2 months ago

                  I thought a lot of places are like that, that’s why we get all the fences and such 🤔

    • Tobias Hunger@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      2 months ago

      If you could reliably write memory safe code in C++, why do devs put memory safety issues intontheir code bases then?

      Even highly paid (and probably skilled) devs in the IT industry manage to mess that up pretty regularly. Even if it was: devs using memory safe languages make much fewer mistakes wrt. managing memory… so that tooling does seem to help them at least more than the C++ tooling helps the C++ devs.

      • lysdexic@programming.devM
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 months ago

        If you could reliably write memory safe code in C++, why do devs put memory safety issues intontheir code bases then?

        That’s a question you can ask to the guys promoting the adoption of languages marketed based on memory safety arguments. I mean, even Rust has a fair share of CVEs whose root cause is unsafe memory management.