C++26 Disapproved
408 points by thatxliner 2 days ago | 351 comments
  • ranger_danger a day ago |
    Maybe this time could be used to consider memory safety much more seriously.

    EDIT: Would love to know why people are so angry about that?

    • GalaxyNova a day ago |
      Memory safety was solved in 1959 with the invention of lisp
    • SolarNet a day ago |
      The issue that caused this to be voted down is often seen as a memory safety solution (not something I personally 100% agree with, but thats a broad view). And the rest of this release includes other memory safety work. And it was voted down and delayed for apparent political reasons (again not a view I agree with).

      So most people will read your view as hypocritical/misinformed.

      • MBCook a day ago |
        It could also be read as a straight up attack. Basically, a way of saying “why not follow Rust“ without having to say the word Rust.

        I think it was a fair question. As someone who doesn’t follow C++ I really don’t know what else was in the proposal. It’s nice to hear there is memory safety stuff.

        • ameliaquining a day ago |
          The memory-safety-relevant parts of the proposal could be salvaged without keeping contracts more broadly, by saying that the relevant behaviors (like indexing past the end of a std::vector) cause program termination in hardened builds. I'm sure it's more complicated than this but I don't think much more.

          More generally, the C++ committee has had a really hard time agreeing on memory-safety stuff because there are a lot of different constituencies with completely different priorities (especially whether they're using it for greenfield vs. legacy vs. something in between), and the incentive is to make proposals sound good to everyone at the expense of actually being coherent.

  • hankbond a day ago |
    Maybe my reading comprehension has just nosedived but I could not find where this article discusses what the heck Contracts refers to?
    • AlotOfReading a day ago |
      You'll find plenty of info if you search for anything like "c++ contracts" [0], but the short of it is that they're just pre/post conditions on functions. Slightly improved assertions, basically.

      [0] https://en.cppreference.com/cpp/language/contracts

      • btown a day ago |
        https://www.cppstories.com/2026/cpp26_contracts/ is IMO a better introduction.

        cppreference is often a bit too technical for its own good :)

        But I think there's a broader issue which is that if it took me multiple searches to find a good-enough visual "pitch" for what contracts look like in practice, its champions have not yet won hearts and minds - which brings us to the situation at hand.

        • bionhoward a day ago |
          Oh im not a c++ guy but that actually looks pretty awesome because it’s like Hoare logic
    • SolarNet a day ago |
      Its a very inside baseball article. Contracts is a proposed C++ language feature for improving programmable assertions of program state. E.g. a better c++ version of C's assert function. That in theory will improve both safety and performance by letting people add more complex assertions (e.g. pre/post conditions) to functions.
  • vivzkestrel a day ago |
    - since you are a part of the voting group, i have a doubt

    - let us say tomorrow everyone were to consider removing all unsigned variables across c++

    - what is the impact in terms of compatibility for all the old c++ applications which i believe would be millions of them if not billions?

    - the reason i ask is they say do not unsigned anything as much as you can because overflowing the bottom below 0 is easy

    - has there ever been any consideration to get rid of unsigned xyz in c++?

    • vivzkestrel a day ago |
      you know downvoting without explaining why is part of herd mentality. i expected better on HN. dont you wanna give some reasons as to why you find this offensive?
    • MFHava a day ago |
      > - let us say tomorrow everyone were to consider removing all unsigned variables across c++

      We would have to at the same time consider removing all bit operations (shifts, bit_and, bit_or, complement, xor, ...) as they are generally unsafe for signed integers.

      That would probably kill a lot of low-level optimisations you were never actively aware of (some tagged versions of SSO, or pointer tagging in general, ...) but relied on for performance.

      So, without thinking of further consequences, I think C++ would be worse of with that proposed change.

  • voakbasda a day ago |
    I feel like this is a bellwether event for society at large. Growing impasses between more and more segments of society. Diminishing trust leading to the inability to reach consensus. Maybe it’s just me though.
    • SolarNet a day ago |
      Perhaps it is, in this case it would be between money and everyone else specifically. Contracts is a pet project of Microsoft and the heavy money parts of the committee. They've basically shouted down the dissenters, hence the effectively unprecedented action of the rubberstamp portion of the process saying they dont think consensus was reached in a kosher way.
      • Maxatar a day ago |
        No one who developed contracts works for Microsoft. Of the like 20 people who contributed to the feature, 4 of them work for Bloomberg, so you could maybe argue that Bloomberg has a vested interest in the feature, but that's really stretching things.

        Support for contracts is fairly broad and spans numerous organizations.

  • LugosFergus a day ago |
    I get why some folks would like to see contracts in the language, but C++ is also buckling due to the shear complexity that's getting tacked on to it. I'd rather see more proposals such as C++26's "erroneous behavior" that attempts to reign in the language's shortcomings.
    • airstrafer a day ago |
      Agree. There's an argument that Contracts reduces the complexity of using the language because it offers a more readable alternative to template metaprogramming (also, it has better error messages). But the argument really falls apart when you review WG21's track record for other features.

      Like for example, Coroutines were billed as an easier way to write concurrent code, but personally I think it completely failed and ended up being hopelessly complex and confusing. Modules are the same - superficially they make things simpler, but when people actually go to adopt it, the details are so complex that nobody bothers.

      • kllrnohj a day ago |
        I think you're confusing it with Concepts. Contracts are basically just asserts, nothing to do with templates.
      • locknitpicker a day ago |
        > There's an argument that Contracts reduces the complexity of using the language because it offers a more readable alternative to template metaprogramming

        Like most people in this thread, you should really read up on contracts before commenting. The contracts proposal is for runtime assertions, and their problem is that they are poorly specified and fundamentally broken. Their proponents haven't been addressing any of their concerns and tried to push a half baked version of them down everyone's throats, which was why they failed to pass.

      • pjmlp a day ago |
        Some do bother, e.g. Microsoft Office uses modules, there is a talk on it.
    • layer8 a day ago |
      *sheer
      • MathMonkeyMan 7 hours ago |
        It's shear complexity because it's about cross-cutting concerns, or because it's a difficult yak to shave.
  • skrrtww a day ago |
    Personally I'd like to see C++ chill out on new features and maybe sort out the shitshow that is char8_t and std::filesystem.
    • Krutonium a day ago |
      Maybe a slightly faster std::regex or whatever it's called; apparently it's horrendously slow for no benefit.
      • stingraycharles a day ago |
        Ranges need work as well, there’s lot of opportunity to improve things there.
      • ameliaquining a day ago |
        The primary reason this hasn't happened is that it'd break C++'s de facto stable ABI (even though officially there's no such thing). For a lot more context, see https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p20... and https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p18....

        Spoiler alert: The option described as "the sort of leadership failing that I pray we can avoid" is what ended up happening.

        • charcircuit a day ago |
          Who cares about the ABI when the current ABI has a bunch of bad issues with it. For any backwards compatibility thing there is always AI that can rewrite old code.
          • NekkoDroid a day ago |
            The compiler vendors care. It is also the reason why C++ never actually had a GC, even if the standard had it specified (and removed it with C++23).
          • bluGill a day ago |
            ABI isn't just what rewriting code. Even if you rewrite the code, you still have to test it, certify it, and so on. Because C++ has an ABI, I mix code that is already built with new code and only recertify my new code.

            It is a huge pain, and quite honestly, most of the reasons I have to maintain ABI are political and thus not up for a technical discussion, but I still have to do it.

            • charcircuit 20 hours ago |
              You can make linking against different abi not allowed. And all the stuff you are complaining about can be handled in <24h by an AI agent (swarm).

              It's just bureaucracy preventing it, not the actual work needed by people.

        • imtringued a day ago |
          I'm pretty sure that it is too late for C++ to break the "stable ABI" they already have.

          It's not too late to introduce an actual stable ABI though. However, it's not too late to do that in Rust either so I don't see the point in a language specific ABI in the future anyway.

      • failbuffer a day ago |
        As an avid non-C++ programmer, can I suggest doing something about the build/module system? I shouldn't have to learn a separate language (CMake) and figure out the right include files to pull in a library.

        I mean, I mainly say this to joke because it's probably unfixable at this point, but whenever I mess with it, I'm struck by how hard/opaque C++ makes this problem compared to most other languages.

        • 4k0hz a day ago |
          The (lack of any) build system is actually nice for flexibility. You can lay out files however you want, link together random object files without extra work, use your own weird dependency tracking, etc. Obviously it's not super easy to get started with compared to Rust et al. but choosing C++ in the first place implies some need for industrial grade features or unusual setup.
          • hdjrudni a day ago |
            Sure, but JS has a myriad of choices too and yet we mostly agree on node_modules, package.json and npm (the repo). Big companies or weirdos are free to swap any of those with something else if they want but the little guys have something standardish if they don't want to inflict too much pain upon themselves.
            • rerdavies 20 hours ago |
              Personally, I find node_modules and package.json completely terrifying. A solution teetering on the brink of a catastrophic implosion. I have a moderate sized project that pulls in several hundred dependencies and dependencies of dependencies, any one of which could contain a supply chain attack when I upgrade my dependencies. Which I must do. Upgrading is not an option; but it's only a matter of time before I get hit.
        • jjmarr a day ago |
          There is no standard build/module system or way of dependency management. Unfortunately, this is because there's no standard compiler with standardized flags so C++ would also have to standardize compiler behaviour too.

          Large FAANGs that would be incentivized to change it don't care because they have their own in-house C++ build systems like bazel (Google) or buck2 (Meta) that are far faster than cmake (distributed compilation and caching) but require huge teams to maintain. Unfortunately, this distributed compilation and caching layer is something that many other languages don't have since their build systems are made for single devs building locally.

          Also the dependencies can be added in a myriad of ways. Your build system can download them, your meta-build dependency manager can find them (Conan), your Linux distro can provide them (system libraries), or maybe you just download an object file from a website + some headers and are told to figure it out yourself (many commercial packages like cuda or steam).

        • ameliaquining a day ago |
          It's probably possible to improve things here, but it's likely best done as a separate open source project.
        • weitendorf a day ago |
          Like most things in C++, everybody who uses it professionally has already solved this in one way or another in a way that works for them.

          So this is only a painful problem for people who don't use C++ very much, and whatever centralized, official solution to builds would probably not really get adopted by most C++ shops.

          Because of that, even if it were solved, it's likely that it would only solve the problems that people who don't use C++ very much, or who don't invest in build tooling, want fixed. Which is basically what Make was originally.

          IMO it's best to think of C++ as a language only. Because of Microsoft/Sun/the web/etc and the desire to win over developers' business, a lot of newer languages are designed to be batteries-included with official first party tools that are supposed to be the canonical way to solve that particular class of problems. Those languages are essentially products or brands that are part of their benefactors' grand designs for specific business or career outcomes.

          C++ by contrast has multiple competing implementations for basically anything you can think of, and isn't someone's "business" the way most other languages are, so there's no reason to make the out-of-the-box DX better or standardize the tooling. Nobody has any reason to want you to write C++ instead of something else.

        • bluGill a day ago |
          As a C++ programmer. No, you cannot!

          C++ is used for large, very, very, very, very complex problems. Language-specific build systems always like to assume all the world is their language. But not all my world is C++, just 99% and that last 1% is all kinds of weird, screwy things that require a very complex build system. CMake is up to the task, in part because CMake is used for building more than C++ and so they've thought a little bit about the issues I have.

          Anyone who says CMake and C++ are complex languages is utterly completely wrong. Sure, by comparison to something better designed, they're a little more complex, but we're only talking a little bit. Meanwhile, I have tens of millions of lines of code to deal with. My real complexity isn't the language, it's my code and that is far greater than all these little complaints people have about the language complexity.

        • GuB-42 a day ago |
          The lack of a universally accepted "good" build/module system like npm, mvn, cargo, etc... has the side effect of limiting the tendency of relying on way too many dependencies, and also limits supply chain attacks.

          I mean, it is a real problem, it is making life hard on developers for no good reason, but sometimes, artificial friction can work against some anti-patterns. Similar in spirit to "chaos engineering".

        • failbuffer 20 hours ago |
          I like how this post got upvoted by people who share my frustration and then downvoted by fans trying to cope for a build/packaging experience from the last century.
      • forrestthewoods a day ago |
        No. The problem isn’t that std::regex is slow and badly designed. It’s that std::regex exists at all.

        C++ is unique in that it defines a spec for STL but not implementation. The result is something that is both overspecified and underspecified.

        Including batteries is fine. Including a spec for what the batteries should look like is such a profoundly bad idea that no other major language does it.

        • ameliaquining a day ago |
          I'm confused about what exactly you're arguing for. Is the idea that the standard library should be minimal and then each compiler should ship its own nonstandard "batteries" library?
          • forrestthewoods a day ago |
            I think the language committee should provide a spec where required (OS filesystem, mutex, etc). And when it is not required they should simply provide a plain bog standard library.

            There is absolutely no reason for std::deque to be a specification. The committee should either ship a committee library for std::deque or they should leave it to the community. They can provide a battery or they can not. Providing a spec for a battery that is both over and under specified is the absolute worst possible choice.

            • ameliaquining a day ago |
              Do you also think the committee should ship a compiler? If not, what's the difference?
              • tancop a day ago |
                Compilers are complex, platform specific and the architectures behind them can be wildly different. Maintaining a reference compiler would be a lot of work for no real benefit.

                The standard library on the other hand is a library. It's almost always implemented as plain C++ without much platform specific code. ISO could take an existing free licensed implementation and declare it as the standard. Of course anyone is free to make their own competing one, it just has to always match the official library's behavior.

                Writing a spec instead of code is just creating duplicate work and compatibility issues any time the spec is unclear.

              • forrestthewoods a day ago |
                The difference is that I can trivially write a std::deque container that runs under any compiler that implements the C++ spec.

                Why on earth would I want a different implementation of std::deque on each platform I use because the compiler team needed to provide one? It’s madness!

              • imtringued a day ago |
                The standard library would just be C++ code that a compiler turns into machine code.

                I remember a language where the core language types, including primitives and a bunch of keywords, were actually defined in the standard library and the compiler just special cased support for the types in the standard library for optimization purposes.

                Your loaded question feels very silly from that perspective.

        • klempner a day ago |
          I think this is misunderstanding the problem with std::regex -- the problem isn't so much that it provides a "spec for what the batteries should look like" but rather that it is naturally ABI entangled and so the bad first generation implementations are unfixable given that the committee refused to allow for an ABI break to fix this.

          The real problem is the latter: C++ has always had a "you don't pay for what you don't use" as part of its core philosophy but it turns out that doesn't apply if the thing you don't use is ABI stability.

          (and, failing an ABI break story, std::regex should have had an implementation that was more PIMPL and less template so it would have fewer ABI issues, possibly followed by a regex2 later that could get more of the compile time bits once implementations were more mature.)

          • forrestthewoods 15 hours ago |
            I think both are problematic.

            I think even if C++ had a periodic ABI break that even a better std::regex spec is fundamentally wrong.

            As someone who ships cross-platform I never ever want different platforms to have different implementations for things that are not actually platform specific. Having different implementations of std::string depending on if I’m on windows, Linux, Mac, iOS, Android, PlayStation, Xbox, or Nintendo is a profoundly terrible thing to do.

        • dizzant a day ago |
          I'm sorry you don't like std::regex. That isn't a problem with C++'s specification practice.

          C++'s separation of spec from implementation is clearly functional. There are several major open-source standard library implementations that compete on the basis of performance, ABI stability over versions, quality, etc.

          C++'s core ethos is "only pay for what you use". std::regex does this. In my experience, the "problem" with std::regex is that it provides more features by default than most people want, and you pay for using those features. Specifically, std::regex respects the runtime locale. There are good reasons a standard library feature might do this (e.g. it simplifies the interface, it's broadly applicable, etc.), but it's obviously not going to give optimal performance. This is a necessary tradeoff for any standard library.

          Locale handling requires dynamic memory allocation, virtual function dispatch, sometimes system calls. Locale handling also prevents some low-level optimizations based on the character encoding. If you need that kind of performance, std::regex probably isn't for you, go grab a non-standard library that suits your needs.

          • forrestthewoods 20 hours ago |
            locale is a great example of a concept that is catastrophically bad, provides zero value, and shouldn’t exist at all in the spec.

            std::regex is so worthless that no one uses it. My codebase gives CI warnings when it’s used. so it’s not even really a problem. It is indicative of a larger problems.

            > C++'s separation of spec from implementation is clearly functional.

            Your bar of “clearly functional” is is not a compelling or meaningful bar. What a weird fallacy.

            C++11 was pretty great and meaningfully modernized the language. The amount of useful good things in each following release got smaller and smaller. Maybe just one or two useful improvements in C++20. Almost nothing in C++23. And now C++26 has failed to pass. It’s grinding to a halt. The biggest recent features such as concepts and modules have been catastrophic failures.

            Those failures aren’t all due to my specific complaint of “battery specs are a bad idea”. But “functional” is the lowest possible bar. And one could argue that as a whole isn’t being met.

  • SP3269 a day ago |
    Time to cancel the project. C++ acquired sufficient set of features over the years, becoming very PL/I-esque.
  • jandrewrogers a day ago |
    As someone who writes high-reliability C++ but is completely outside the standards process, I see the issues with C++ Contracts. It isn’t clear that it solves a problem that anyone has in real codebases, especially after C++20 concepts.

    If you were already writing high-reliability C++ then the benefits are difficult to quantify. If you weren’t writing high-reliability C++ then it saves you almost nothing over doing the standard idioms of high-reliability C++ that were already available to you at very marginally more cost. It does standardize expression of it in narrow cases but the payoff seems minimal.

    Most of what C++ Contracts delivers is a mashup of what you can already do with constexpr and C++20 Concepts. I like reliability features but this feature, as delivered, looks fairly useless if you already use reliability features. A compelling standard would need to make much deeper guarantees out of the box. And the compiler can already see through most compositions of constexpr and C++20 concepts, which is already very expressive.

    C++ Contracts looks a bit like a feature that was designed long before current standard features existed.

    • drivebyhooting a day ago |
      Your comment just made me realize contracts is different from concepts (which are basically bounded genetics, right…?)
      • stingraycharles a day ago |
        Concepts are evaluated compile time and make a lot of TMP more elegant. Contracts are runtime check, akin to assertions.

        Phrased differently, contracts are to concepts what assert is to static_assert.

        • mikepurvis a day ago |
          Too bad it couldn't have been contract and static_contract.
        • rerdavies a day ago |
          I think the wumpus that's being chased is that contracts COULD evolve into a compile time check. I'd be much happier if they actually caught the wumpus before they start polluting the language with yet another baroquely complicated feature that gets abandoned before it actually becomes useful (e.g. coroutines, and modules). Or just keep it simple and give us a C++-sensible replacement for assert(), and avoid the rest of it. i.e. contract_assert without the word "contract" in it. That would be a nice feature.
          • MFHava a day ago |
            Funny how often I read online that Coroutines are abandoned/useless, yet we ship products based on them and their application in our codebases grows continuously...
          • bluGill a day ago |
            Today the compiler is allowed to fail to compile any code that will break a contract. However the details of what this means is very complex, and the ability of compilers to detect things that break the contract at still evolving. Thus forcing anything on a compiler would force an easy subset on the compilers while shutting down innovation in what we can do in the future.
      • rramadass a day ago |
        Concepts are for Types at compile time while Contracts are for Values at runtime.
      • jandrewrogers a day ago |
        C++ concepts evaluate the properties of types at compile-time. You can inject arbitrary constraints on type properties anywhere in the code including conditional codegen. It is a way of asking if a type “can express this complex set of abstract things or has this enumerated set of properties” with almost arbitrary detail. They are extremely powerful in terms of expressiveness and specialization of code. Insanely good for performance and reliability engineering.

        One of the best features to be added to C++ in many years.

        C++ contracts are an attempt to bring C asserts into the C++ age. The weakness of C++ contracts is that they are mostly syntactic sugar over C asserts. If you really care about this type of thing, you probably already have a custom C++ assertion framework that is at least as capable if not more.

        The promise of C++ contracts is that they can aid formal verification, which would be great. As delivered, it can’t do much more than was already possible, which will inhibit adoption.

        • AlotOfReading a day ago |

              The weakness of C++ contracts is that they are mostly syntactic sugar over C asserts. 
          
          The sugar is actually one of my issues with them. The evaluation semantics are much more complicated / potentially slower than C asserts because of the sugar, and why you would have to pay those costs isn't obvious at first glance. Lisa Lippincott's excellent talk on the design of contracts [0] is what switched me from a sort of neutral support to disliking it. I think it's a stupid place for the national bodies to draw the line though. std::regex is acceptable, but a nothingburger like contracts tanks the vote?

          [0] https://www.youtube.com/watch?v=yhhSW-FSWkE

          • jandrewrogers a day ago |
            To be clear, I have a lot of issues with the contracts proposal. I probably wouldn’t use despite living out on the standards frontier. I don’t even use C asserts already because they are not expressive enough in important ways. This proposal kind of reifies the inadequacies.

            I think the risk is that C++ contracts become an evolutionary dead-end that hang around forever in code bases because they were standardized. It wouldn’t be the first time this has happened.

            • randomNumber7 a day ago |
              What do you do instead of C asserts? Throwing exceptions?
        • amluto a day ago |
          I maintain a codebase that I’ve migrated from C++98 to C++11 and all the way to C++23 and even a bit of draft 26 (the latter for some minor library improvements). Few things made me quite as happy as moving from using SFINAE to using requires clauses and concepts.

          (IMO the single best improvements over the years have been atomics and maybe variadic templates.)

          • jandrewrogers a day ago |
            I think you are right to position atomics and variadic templates as among the most consequential features of C++ in the last couple decades. It made an enormous number of things possible.

            One thing I give the C++ feature gods credit for is recognizing material deficiencies in systems languages and unapologetically trying to fill those gaps starting with C++11. The addition of atomics, strict variadics, constexpr, lambdas, concepts, lifetime annotations, etc has been transformative for C++.

            • aw1621107 19 hours ago |
              > lifetime annotations

              Say what!?

          • throwaway2037 a day ago |

                > the single best improvements over the years have been atomics...
            
            Of course, libatomic and friends have existed for a long time. Real question: Do you feel that the standardisation of atomics within the C++ base library is a material advantage over using libatomic? Also, maybe there are atomic APIs in the C++ base library that are better than libatomic. If so, please kindly share an example or two. I would like to learn more.

            EDIT

            I forgot to give a hat tip to your big upgrade from C++98 to C++23. In some projects, that can require an enormous amount of effort! Can you share a "stories from the trenches" that were difficult in that upgrade?

            • pocksuppet a day ago |
              libatomic is a GCC implementation detail that implements atomic math operations that are not available on the target platform by using non-atomic math and compare-exchange. Are you sure that's the one you mean?
            • bluGill a day ago |
              Standards work best when they can take a bunch of existing slightly different implementations and pick the best of them all, with input from people who understand the compromises, and with input from the real world experience of the different ways those compromises work out in the real world.

              Atomics could work that way. However many other things cannot - we knew modules were a good idea, but they are a everything on a project must use them before anyone can benefit and so they were forever doomed to not be in widespread use until there is a standard. Even today we see adoption is slow because while there is a standard that works everybody is waiting on some other part to adopt before they can get any benefit. (and those who need to go first see the least benefit), but there are signs that things are moving.

          • Shorel a day ago |
            I want to read your blog describing these experiences.
      • YuechenLi a day ago |
        A concept is a compile time requirement that bounds templates which are the generics in C++, so you are close.
    • quotemstr a day ago |
      Huh? Concepts are types of types. Contracts are fancier, structured runtime assertions. What does one have to do with the other? They're nothing alike.
      • rramadass a day ago |
      • jandrewrogers a day ago |
        That’s exactly my point.

        Contracts notionally offer the ability to lift some runtime assertions to compile-time. That is how it was sold. Except they don’t in practice.

        Meanwhile, concepts + constexpr if used artfully deliver that in practice, including for many cases that contracts were supposed to solve.

        I push all verification to compile-time to the extent possible.

        • quotemstr a day ago |
          I don't buy the idea that in "high-reliability C++" every condition worth checking can be checked statically, not unless you define "high-reliability" vacuously as that set of programs for which the claim is true. Real-world programs have legitimate reasons to verify invariants dynamically, and C++26 contracts provides an improved way to do so.

          While the C++26 variant of contracts doesn't provide the benefits of its static-analysis-centric ancestor from 2014, and therefore isn't as consequential a feature, it still provides value to some and is absolutely not important enough to be worth killing a standard. Concepts do not provide this value.

          In any case, it's simply false that C++26 contracts are unnecessary because we have concepts, yet this claim is the thrust of your initial comment.

          • rramadass a day ago |
            > While the C++26 variant of contracts doesn't provide the benefits of its static-analysis-centric ancestor from 2014

            Do you have any information as to why they shifted the focus from static analysis to runtime checks? I only remember that it was based on some Microsoft annotation language or something.

            • bluGill a day ago |
              Static analysis is hard. C++ 26 contracts are supposed to be the minimum viable feature that can be expanded on in future revisions.

              Already the compiler is allowed to refuse to compile any code if it would guaranteed fail the contract. The next step is to see how far we can go with that static analysis and what those static analysis tools need to be better. However, this requires people having contracts in fairly widespread use so they can start trying their new ideas to see what happens when they hit the real world.

              • rramadass a day ago |
                The original idea for C++ contracts was to implement something like Microsoft SAL notation (sometime in 2014) to enable full static analysis and that is what i was hoping for.

                See my comment here - https://news.ycombinator.com/item?id=50361418

                However, i also understand the reasoning behind this C++26 contracts proposition - https://news.ycombinator.com/item?id=50364593

                While i understand the rationale here, i can also see the problems it might lead to in the future. Correctness concerns should be an all-or-nothing proposition, you cannot do it piecemeal. Hence whether you want to call it "profiles" or not, i would like a Eiffel/Ada-SPARK like system which gives me complete static compile-time analysis and verification along with separate run-time guarantees.

                The contracts committee should go back to the drawing board and come up with a more comprehensive solution.

                This is a real chance to finally realize the "Safe C++" dream! Ada did it and so can C++.

          • jandrewrogers a day ago |
            The issue is that contracts are less flexible than the existing capabilities in practice, it is limited syntactic sugar.

            Contracts were sold with the idea of aiding compile-time verification, a noble purpose. The combination of concepts + constexpr allows you to do deeper compile-time verification today by other means than contracts can check. It isn’t obvious that this will ever not be the case. This means contracts is relegated to being another flavor of C asserts.

            C++26 contracts are arguably unnecessary because we can achieve the same results other ways, sometimes with stronger properties. I’m a proponent of features that clean up the syntax but C++ contracts look like a nod to people that still use legacy C asserts. That’s fine but it also perpetuates an inadequate model of what assertions should be capable of expressing.

            People figured out how to do with C++20 better than what contracts promised.

            • quotemstr a day ago |
              There's nothing "legacy" about checking invariants at runtime, and you can't simultaneously dismiss the concerns of people doing so on the grounds that they're "still us[ing] legacy C asserts" when you deny them an alternative to "legacy C asserts". That's question-begging.

              > People figured out how to do with C++20 better than what contracts promised.

              What contracts used to promise is irrelevant. The contracts on the table modernized runtime assertions and are irrelevant to concepts, constexpr, and related facilities.

              Is the contracts feature more useful than C's assert()?

              If you want to argue that we're better off with the old macro, do so directly. Concepts, in this context, amount to irrelevant distraction.

              • jandrewrogers a day ago |
                I have no issues with people check invariants at runtime. It is unavoidable. C++ contracts is a mediocre way of doing it. Many C++ code bases don’t use any macros at all for assertions and haven’t for a long time. Their models are much more nuanced than C++ contracts allows.

                Why would anyone that already ditched C asserts use C++ contracts when it can’t express what the alternatives already can? This isn’t a new problem. People were creating more expressive assertion replacements than contracts offers a decade ago.

                C++ contracts are nerfed. It is less expressive and capable than what anyone that cares about these things already uses. So who is expected to use it?

                • rramadass a day ago |
                  > Why would anyone that already ditched C asserts use C++ contracts when it can’t express what the alternatives already can?

                  You have not understood the C++26 contracts proposal.

                  It introduces three new syntax viz. "Pre" and "Post" in function signature declaration and a separate "contract_assert" which you can use anywhere in the code path.

                  It is the "Pre"/"Post" that is useful here. Since it is part of function signature declaration, a static analyzer can easily make sure that all function calls satisfy the contract else you get warning/error. The compiler on its part can inject appropriate code at the function boundary points to do runtime checking etc.

                  You cannot do this with assert macros. If you wanted something like this earlier, you would have had to change the compiler to emit modified function prologue/epilogue and build your own contract framework which few people had the capability to do.

                  You can now see the immediate benefits particularly for standard library (and other) code hardening needs. Many UB circumstances can be easily flagged at compile time without too much complexity.

                  Finally, note that if you use compile-time switch "ignore" to turn-off everything, only the runtime checks are elided (so you do not lose any performance) but the static analyzer can still catch all possible inconsistencies at compile-time thus giving you the best of both worlds.

                  • William_BB a day ago |
                    > a static analyzer can easily make sure that all function calls satisfy the contract

                    How realistic is the "all function calls" part? Maybe I just don't see the bigger picture, but I would expect most function calls arguments to only be known at runtime, which of course makes static analysis not possible?

                    • rramadass 9 hours ago |
                      No, that's not how to look at it.

                      Obviously "all function calls" phrase cannot be absolute, but most can be caught with the analyzer giving one of proved/disproved/unknown result. The reason all cannot be caught is because pre/post are logical predicates on sets of values and are not part of the typing system.

                      To understand that, you have to know how a static analyzer works and specifically two of its functions, "Data Flow Analysis" and "Symbolic Execution".

                      It is Symbolic Execution that does static checking without the need for the actual runtime values to be known. It basically "executes" the code mathematically, building logical predicates over "sets of values" (indicated by the type of the variable) and thence trying to prove/disprove the formula using a solver. Note that the program is being "run" abstractly in the mathematical world using quantifiers just like you do in a mathematical proof.

                      If you know Hoare triples, and Dijkstra's WP-Calculus you know how to do this mechanically.

                      So the analyzer does two things; a) in the function itself it assumes pre is true and tries to prove post and b) at the call site it makes sure the paths leading up to the invocation satisfy the pre/post args/result needs thus chaining everything through the codebase. Both are done using symbolic execution. If it cannot prove/disprove the assertions, it remains silent (i.e. "unknown" result above) and leaves it to runtime checks to catch the violations.

                      Some resources:

                      1) How Static Analysis works - https://pvs-studio.com/en/blog/posts/1048/

                      2) A Gentle Introduction to Symbolic Execution for Software Security - https://can-ozkan.medium.com/a-gentle-introduction-to-symbol...

                      3) Scaling Symbolic Execution to Large Software Systems - https://arxiv.org/abs/2408.01909

                      • William_BB 4 hours ago |
                        Thanks for a detailed response, this is very educational
      • taybin a day ago |
        They both start with the letter C, have two syllables, and have/had a hard time getting into the standard. If you’re not paying close attention, it’s easy to get them confused.
        • moomin a day ago |
          I’ll admit I only learned they were different today. I’d like to think that if I were a regular C++ user I’d be on top of this, though.
    • throwaway2037 a day ago |

          > high-reliability
      
      I never heard this term used with C++ before. Can you explain more? Ideally: Can you give an example snip of code that demonstrates it clearly?
      • arein3 a day ago |
        Its a set of rules, used by defense software, they are available on the internet
        • NSUserDefaults a day ago |
          For example the failed F-35 project used it. Seems pretentious and risky compared to using a language that is safe by default.
          • amelius a day ago |
            > compared to a language that is safe by default.

            This also sounds pretentious ...

            • NSUserDefaults a day ago |
              Because you think there is no such language, or even one that gets closer than C++? Look I still kind of like C++… for games. I would never put it in a fighter jet for gods sake.
              • fps-hero a day ago |
                I don’t want to be inflammatory, so let’s stick to facts. The F35 is the manifestation of a test aircraft designed in the 90s. Of that era, software was predominantly single threaded, hardware definitely so. They also weren’t using the latest and greatest of hardware at the time, they opted for proven flight platforms with hardware dating back well back into the decade. So, very lacklustre performance, tight memory constraints.

                The only other legitimate choice for writing software at the time would have been ADA, which for some reason never took off despite being purpose build for the application. Of that time, C++ was the new hotness, it was popular, it was solving architectural problems, and it was performant, unlike say Java.

                It’s fairly naive to say “I’d never use C++”. The C++ programmers of the time would have looked at Fortran or COBOL with the same level of disdain. We are lucky to live in a time of better options, and the impending post code future.

                • tialaramex a day ago |
                  > The only other legitimate choice for writing software at the time would have been ADA

                  Ada makes a lot more sense for this work than C++ did twenty years ago.

                  • bluGill a day ago |
                    Ada didn't make sense either: nobody wanted to learn it.
                    • SolarNet a day ago |
                      There were schools of computer science, accredited universities, that taught it heavily (one of the 3 lab intro to programming languages next to c++ and python, and allowed to be used through the entire program at mine). A 1/3 of graduates of some of these places got jobs in it, because they were reliable and well paying jobs.

                      And then the industry swapped to C++. This was not a DoD mandate, this was companies like boeing trying to pay their engineers 1/3 to 1/2 less by paying for C++ devs (starting salary for ada devs was 90-140k, starting salary for c++ devs was 60-180k according to exit statistics). They of course eventually learned that good C++ devs are actually more expensive than their old Ada ones. Not that they bothered to hire good c++ devs.

                    • pjmlp 21 hours ago |
                      Yes we did, the major impediment was the price of available compilers, their dependency on UNIX workstations, where the Ada compiler was extra, on top of C and C++ that were already there.

                      Until Ada Core offered GNAT to the community, there were no affordable compilers.

                      Yet, there is still enough business to keep 6 compiler vendors selling them.

                    • Maxatar 18 hours ago |
                      No it wasn't that nobody wanted to learn it, it's that back then Ada developers cost a lot more than C++ developers and businesses didn't want to pay them.
                • drysine a day ago |
                  >it [C++] was solving architectural problems

                  What do you mean?

                • NSUserDefaults a day ago |
                  “Let’s use the new hotness for this new fighter plane” maybe puts things into perspective for me.

                  In today's terms, that's like vibecoding a Mars mission vehicle just because it's "cool".

          • Cthulhu_ a day ago |
            What language do you propose?

            (I'll just pre-empt that if you say "Rust", Rust wasn't around until recently and the F-35 project started in '93. These things span decades, while only a few programming languages do)

            • tialaramex a day ago |
              C++ is a pre-standard "Eh, just do whatever" language in 1993.

              Bjarne's 2005 JSF rules have the same effect as an "Employees must wash hands" sign. It's not the billion dollar fast food chain's fault that a minimum wage employee didn't obey the sign and now you've got food-borne illness. They put a sign up!

              • pjmlp 21 hours ago |
                He always misses the amount of avionics bugs that the F-35 suffered from, in spite of the rules.
            • LiamPowell a day ago |
              The incredibly obvious answer is Ada, given the DoD commissioned it and the fact that it was used for the F-22.
              • fpoling a day ago |
                I wonder if DoD desire to tap into a bigger pool of C++ programmers also brought a lot of people who was not trained to write a high-reliability code.
            • SolarNet a day ago |
              Ada is far safer than Rust (not in edge case memory allocation problems, but in day to day application programming), and not only existed at the time, it was the industry standard for aviation (for good reason). Entire educational programs and pipelines existed for it.

              Boeing and other defense contractors dropped it because C++ programmers were cheaper on paper (not realizing/caring that good C++ engineers were more expensive).

              • cestith 20 hours ago |
                One of my current coworkers used to work on on-board systems for military aircraft. Anecdotally he tells me the critical systems for the ones he worked on were Ada but other systems could be C++.
          • AnimalMuppet a day ago |
            In what sense was the F-35 project a failure?
          • AdamN a day ago |
            Username checks out :-)
        • weitendorf a day ago |
          I think you're thinking of https://en.wikipedia.org/wiki/High_Integrity_C%2B%2B

          I wrote a comment explaining what in my mind distinguishes "high reliability" (defensive programming and making invariants/error cases/intended use explicit) C++ from regular C++. IMO it basically boils down to contemporary "Google/fintech style C++", which is a different development culture and ecosystem from defense/automotive

          • fpoling a day ago |
            The biggest split is not using exceptions with aborts on memory overflow. It alters the programming style to such extent that it feels like a different language.
      • zaphirplane a day ago |
        Top 2 Google search result are ..: this post and this article
        • Rexxar a day ago |
          Google give enormous priority to new content, especially on very well referenced and active sites like HN. So it probably doesn't mean as much as you think.
          • Maxatar 19 hours ago |
            I can search for many technical terms that have recently been posted to HN and it and appear in the comments and it won't come up on the front-page, let alone the first two items.
      • weitendorf a day ago |
        Assuming the original commenter is referring to essentially best-practices, defensive C++ like you see at Google and projects like Envoy proxy, and the other reply is prob mixxed up and thinking of high integrity C++ [0],

        Here's an example that uses compile time type assertions (static_assert, C++ can already do this), runtime errors (CHECK, standard Google/abseil practice for explicitly handling invalid states and invariants), test/dev checks (defensive programming, basically an inline test), and wrapper/error handling types to do what you might want contracts to do:

          template <typename T>
          absl::StatusOr<double> Percentile(std::span<const T> sorted_values, double p) {
            static_assert(std::is_arithmetic_v<T>, "T must be numeric");
            CHECK(p >= 0.0 && p <= 100.0) << "p out of range: " << p;
            DCHECK(std::ranges::is_sorted(sorted_values)) << "input not sorted";
        
            if (sorted_values.empty()) {
              return absl::InvalidArgumentError("empty input");
            }
        
            const std::size_t last = sorted_values.size() - 1;
            const double rank = p / 100.0 * last;
            const auto lo = static_cast<std::size_t>(rank);
            const std::size_t hi = std::min(lo + 1, last);
            const double result = std::lerp<double>(sorted_values[lo], sorted_values[hi],
                                                  rank - lo);
        
            DCHECK(result >= sorted_values.front() && result <= sorted_values.back());
            return result;
          }
        
        (function impl is AI, only need it as scaffolding to demonstrate the contract-adjacent, non-implementation code)

        Before I was exposed to this style of C++ and learned to write it, C++ basically felt like a different language. People say that the C++ standards committee and language designers have different priorities and developer culture vs most big tech companies/finance and I think it's because even if they're aware of the features and tools that come out of Google (et al) [1], they don't use them in their current day to day jobs and want that functionality in the core C++ toolchain.

        IMO, a lot of what they want to add is already "solved" by third party tooling, but because for whatever reason they don't use those as part of their everyday work, they sometimes come up with language features that overcomplicate or solve the wrong thing, in a way that you would intuitively understand if you were already regularly using the 3P tools that solve them.

        I could also be the one misinterpreting things here so apologies if this is obvious or not what the original commenter meant by "high reliability".

        [0] https://en.wikipedia.org/wiki/High_Integrity_C%2B%2B

        [1] https://abseil.io/about/ one of many third party ways to make C++ less insane

        • pedro_caetano a day ago |
          If you squint hard enough your example does look a lot like Ada pre and post condition contracts (perhaps a bit less ergonomic, at least for someone who hasn't written C++ in a while).

          At this point the rust contracts crate with requires/ensures looks like a more straightforward approximation of Ada's Contracts and assertion policy. But still as far as I am aware no one has implemented something that mimics the static proof functionality in Ada's SPARK subset (which arguably not all applications or problem domains actually need or can justify the extra effort/cost).

        • rramadass a day ago |
          > IMO, a lot of what they want to add is already "solved" by third party tooling,

          https://news.ycombinator.com/item?id=50364593

          • weitendorf a day ago |
            I haven't seen any good examples of contract preconditions that I would actually want to use. What I've seen is stuff like

              double safe_sqrt(double x)
                pre(x >= 0.0)
                post(r: r >= 0.0)
              {
                return std::sqrt(x);
              }
            
            Preconditions violate the principle of "make invalid types unrepresentable" but look like they're helping. They are basically a oneoff extra specific type that (if the state you're checking is worth checking at all, it must be representable in the actual argument's type) contradicts the actual argument's type. So why not change the argument's type directly?

            Because it's hard, or not possible, for the same reason that most of these preconditions aren't generally statically verifiable.

            Suppose your precondition is x > 5. Statically, you can stop someone from directly passing a literal <= 5, detect locally declared variables assigned to numeric literals and do the same. But to generally infer whether any argument satisfies specific properties quickly gets extremely complicated, because how can you generally verify that the calculations done to a const or literal within the caller's scope guarantee certain properties about the output, without actually performing the calculation? You can come up with cases where you only add to an int and you see it was initialized to 0, so you know it's never < 0 barring underflow. Those are the easy cases

            If the caller is passing in something derived from their own arguments, or from I/O, all bets are off. All you know is that the argument has a type, and its value was derived from unknown inputs. So you need a runtime check to actually assert your precondition and make it behave like a type check. But then what happens if input doesn't meet the precondition? Do you throw an exception or crash?

            I think that there should be a reference implementation for a useful static analyzer for preconditions, for it to be added to the language. Obviously it would be nice if you could verify that callers only pass in x > 5 to your function, but I think deferring the semantics for contracts to however the build/compiler chooses to handle them (because they might, one day) is not good enough for adding a new feature and syntax to a language. If preconditions can be used for useful static analysis beyond what static asserts and the type system gets you already, there should be evidence for that. I'm skeptical that you can do any better than a regular static assertion/type checks.

            Also, I do think the lack of explicit handling (if in practice preconditions are only generally evaluable at runtime) in the contracts syntax is bad. The proposed syntax looks too much like a type or static assertion for a runtime check (note that you can easily see what CHECK/DCHECK macros actually do just by clicking through to their definition). And if it isn't in practice just a runtime check, there should be proof!

            • William_BB a day ago |
              > If the caller is passing in something derived from their own arguments, or from I/O, all bets are off.

              This is the part of contracts that I don't understand. I suppose you could (1) runtime validate any user input to the program and then (2) chain multiple functions like `safe_sqrt` that provide pre and post conditions.

              In theory, this should allow the static analyzer to reason about any arbitrary input. However, this to me raises even more questions: is this practical, is this possible and why would I not try to achieve the same through types ("make invalid types unrepresentable"). Maybe I'm completely off the mark here.

              • weitendorf 19 hours ago |
                No I completely agree. I think it is almost a deus ex machina/wishful thinking where people wish type systems could handle invariants like this, and know at least some invariants should be easy to enforce statically, but haven't seriously considered whether all invariants generally can be feasibly statically verified at buildtime.

                If they can't, then it is IMO a mistake for the language to make contracts declarative (like types), or to think of the static checks as anything more than something extra on top of what is actually a runtime check. And if they can, then why are they not just types?

                Bad idea to assume "someone will write static analyzers", and use that to justify a language feature capable of expressing much more complex logic than any static analyzer would be capable of handling.

            • rramadass 8 hours ago |
              Nice. However, you are mixing up both sides of the "Curry-Howard Isomorphism" i.e. Set Theory/Predicate Calculus vs. Lambda Calculus/Type Theories i.e. Classical Logic vs. Constructive Logic.

              See also my comments here - https://news.ycombinator.com/item?id=50365641 and https://news.ycombinator.com/item?id=50375318 (this one explains how static analysis works which is the confusion i see above).

              The idea of a "proof" which is what Symbolic Execution by a Static Analyzer does is different on both sides of the above isomorphism. You cannot mix them indiscriminately. This is because C++ does not have a typing theory (in the sense of lambda calculus derivatives) but simply maps types to sets. Hence one cannot do "Type-Driven Design" natively like a lambda calculus-based language even though you can do aspects of it via explicit programming techniques (eg. see "Functional Programming in C++ by Ivan Cukic").

              That is the reason i suspect contracts in C++ moved away from the original focus on static analysis to managed runtime checks + some static analysis. C++26 contracts are firmly in the Set Theory/Predicate Calculus camp and are not integrated into the Type System.

              We need an augmentation of the C++ type system and then a narrowing so we can end up with something like Ada-SPARK (call it "Safe C++"/"Profiles"/whatever).

    • pjmlp a day ago |
      The problem is that the current design doesn't take into account binary libraries, or what happens when conflicting contract modes are linked together, as contracts aren't reflected on ABI.

      Additionally they offer very little mechanisms versus Eiffel's original design, Ada/SPARK or Frama-C.

      A basic MVP, expected to improve on subsequent C++ version, assuming that the proposal authors stick around for those evolution proposals.

    • throwaway81523 16 hours ago |
      I don't understand the controversy or objections, though maybe I'm missing something. This looks like Ada-2012 contracts which evolved from SPARK Ada going back to near-ancient times. They're well accepted I thought. The idea is to standardize the syntax so that static analyzers can check the contracts, like in Ada. I think Rust is getting something similar. It seems important. Maybe the DIS was rejected because there are still disagreements about some details, ok fine. But rejecting the whole feature sounds counterproductive to keeping C++ relevant. Assuming that last is a good thing, of course.
      • steveklabnik 16 hours ago |
        Those are evaluated at compile time, C++’s aren’t guaranteed to be, they’re runtime checks.
        • throwaway81523 15 hours ago |
          Yes, static checking when available will have to figure into the toolchain so the compiler knows what to do. It's similar with Ada right now.
  • wahern a day ago |
    Correct me if I'm wrong, because I don't follow C++ very closely, but based on previous discussions on HN, the opposition paper obliquely referenced in the blog post was presumably Bjarne Stroustrup's, who IIRC had already said he would work behind the scenes to make sure the final pro forma vote to standardize C++26 would fail.
    • Maxatar a day ago |
      Yes that's right, and from following some threads on reddit about this, he used some really dirty tactics to get it to fail, like scheduling certain snap elections to happen with very short notice at times of the day when people who would oppose his point of view would likely be asleep.
      • adzm a day ago |
        So is he a hero, or villain? Does it all come down to concepts?
        • afdbcreid a day ago |
          Not concepts, contracts.
      • zugi a day ago |
        Reddit is a cesspool, I wouldn't put faith in anything you read there.

        There were no "dirty tricks". The C++ standards committee works by a vaguely defined "consensus", which requires more than "the majority rules". Contracts got added to the C++26 draft. Then there was consensus that Contracts needed to be fixed, but they could never get consensus on any particular fix. So they cruised along relatively unchanged.

        In the end, the only way to NOT accept a marginal Contracts feature was to vote down the full language spec. Now they'll regroup and decide how to proceed.

      • raegis a day ago |
        > ...at times of the day when people who would oppose his point of view would likely be asleep.

        Stroustrup is 75 years old. This is not only hard to believe because of his age, but also because it requires that people who oppose his views somehow have distinct sleeping patterns from ones who agree with his views. Weird, man.

        • hdjrudni a day ago |
          > that people who oppose his views somehow have distinct sleeping patterns from ones who agree with his views.

          Not weird if they're mostly from different continents.

          When I saw him a year or so ago he said he wasn't happy with how things were going, but never alluded to a coup. But it's his language, so good for him.

          • MFHava a day ago |
            > it's his language

            It most definitely is not and hasn't been in decades.

            A major problem is that some people still put his views on a pedestal, acting like he has a clean track record with his ideas, which he definitely has not - no language designer has ...

      • IsTom a day ago |
        If this was true I'd ask myself why he was this motivated to block it. He's a smart man and not a corpo rat to do dirty things just because.
      • aw1621107 17 hours ago |
        > like scheduling certain snap elections to happen with very short notice at times of the day when people who would oppose his point of view would likely be asleep.

        ...He has the power to do this? And for which elections, exactly? The main go/no-go votes are the ones at the big meetings and I'd imagine there's not a lot of room for scheduling shenanigans there.

    • locknitpicker a day ago |
      > Correct me if I'm wrong, because I don't follow C++ very closely, but based on previous discussions on HN, the opposition paper obliquely referenced in the blog post was presumably Bjarne Stroustrup's (...)

      I've noticed that Bjarne Stroustrup is being subjected to a smear campaign, when things are far simpler and far less conspiratorial than they are making out to be.

      There are indeed papers demonstrating that not only is the current proposal for contracts broken but it also fails to adhere to core C++ principles. They have been published since at least 2017. Contracts aren't new, nor the problems they introduced. They've been routinely removed from C++ standards, and so far the proposal wasn't fixed.

      So ask yourself this: why was a notoriously broken feature forced into the proposal when it was clear it wasn't going to pass?

      From an outsider's point of view, I see this from a different perspective. Contracts proponents tried to use bureaucratic tricks and threats of abnormal processes to force a broken feature they knew for years that wasn't supported or passing the smell test. And now that they saw their efforts thwarted , the complain that their plan failed and they have opposition?

      I mean, there is even a paper dating back to 2025 called "contracts concerns" and from 2026 called "contracts fundamental flaws". The C++ standard is a consensus-driven process. Does this look like consensus? Clearly no.

      So we have a group of people who ignored the calls that they were pushing a broken feature, but tried to railroad the process anyway and ignore any concern or warning. Then, when they tried to force their way through the process, their bluff was called and their threats failed. And now they are lashing back.

      • GeorgeWBasic a day ago |
        I would really love to know: who are the people pushing the current version of contracts, who do they work for, and why does the current version of contracts meet their needs if it's so flawed?
        • locknitpicker a day ago |
          > I would really love to know: who are the people pushing the current version of contracts, who do they work for, and why does the current version of contracts meet their needs if it's so flawed?

          It seems the lead author and champion is a guy from Bloomberg, of all places.

          https://isocpp.org/files/papers/P2900R6.pdf

          As the story goes, these guys pushing contracts systematically pushed a broken proposal by dismissing criticism with bureaucratic chicanery such as purposely ignoring feedback and criticism by claiming that if other people voted in favor of their proposal then they shouldn't need to bother with feedback from those who opposed.

          I mean, look at the reaction. It's not technical. It's not principled. It's bureaucratic and grounded on petty politics, and dismissing yet again a failure to gather consensus as personal attacks and a political issue.

          • jcranmer a day ago |
            > As the story goes, these guys pushing contracts systematically pushed a broken proposal by dismissing criticism with bureaucratic chicanery such as purposely ignoring feedback and criticism by claiming that if other people voted in favor of their proposal then they shouldn't need to bother with feedback from those who opposed.

            From what I've seen of the story, the opposite is true. The people opposing contracts are the ones who have been engaging with bureaucratic chicanery to try to rip it out of the standard. In the discussions within the committee, they've been given every opportunity to make their case and had their arguments heard, even when those arguments failed to persuade anyone and are simply relitigated again and again in subsequent meetings as if they're new. In at least one national body, the anti-contracts people used the bureaucratic process to change the vote of the national body.

      • kllrnohj a day ago |
        > I mean, there is even a paper dating back to 2025 called "contracts concerns" and from 2026 called "contracts fundamental flaws".

        Two papers that both have the same authors, one of whom is Bjarne Stroustrup.

        Why are you convinced the narrative is that contracts are actually broken and unfixable instead of a few influential people just really hate it for reasons they have been unable to convince anyone else are valid?

        Have you read the "contracts fundamental flaws" paper? Looking at it now, it's hard to take it seriously. The biggest complaint seems to be that the marketing of contracts is wrong. Literally: "We would welcome a contracts design that is simple, and “marketed” as just a debug aid, rather than a safety feature."

        It really does look like Bjarne is convinced that profiles are the future for C++, and contracts makes it less appealing to get there. And that's something that reasonable minds can just disagree about without it being a conspiracy of some kind. WG21 doesn't seem to believe that profiles are an anytime-soon-if-ever feature, and contracts provide immediate benefit that justifies any future complications with profiles.

        • rerdavies 18 hours ago |
          Having just read Stroustrup's paper (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p43...), I'm inclined to agree with it.

          Stroustrup's objection of subversion of, and politicization of the "consensus" process seems pretty darned reasonable to me.

          And having two major compiler implementers (Clang and Microsoft) among those opposed to the proposal seems like a very poor sort of consensus to me.

          The decision to defer how contracts on virtual methods work until C++29 strikes me as particularly horrifying, and renders the feature completely unusable precisely at the point where it most needed (PIMPL classes where public methods are pure virtual, with implementation provided in a private derived class).

          And reminds me of c++20 coroutines, for which we are still awaiting a usable implementation. I made the mistake of actually writing a wrapper library for c++ coroutines. A great feature, but only heroically usable in its c++20 incarnation. (I actually did use it in project, but was left wondering why anyone would actually release THAT feature without a supporting class library). Implementation details were shocking, and awful, and insufficiently specified. And I would be completely amazed if my wrapper library continues to work with C++26.

          God willing, C++26 will provide an implementation that allows us to sanely use coroutines in message pumps and thread pools soon (such a great feature!), if the standards committee, God Willing, takes the right and good and sensible path of removing contracts from C++26 so that we can get the structured concurrency library.

          All in all, I can't help wondering whether the C++ standard doesn't need "Experimental Features" like Java has. It's certainly interesting to see how The Who Must Not Be Named (Oracle) uses experimental features, some of which have existed in experimental status across four or five Java releases. C++20 coroutines and contracts would have been perfect candidates for "experimental C++ features", that can be tested and hardened and have breaking ABI changes made as necessary and appropriate.

          > welcome a contracts design that is simple, and “marketed” as just a debug aid

          The operative word would be "simple". It's hard to imagine that the feature would require 56 (!!) pages of specifications if the constness rule were omitted. Who the heck ordered that!!??

    • twhitmore a day ago |
      Bjarne Stroustrup has been pushing Profiles, which would allow C++ code (or the majority of it) to become type-safe and memory safe.

      Contracts are useful, but don't guaranteed anything if type safety & memory safety can be bypassed.

      I think the ISO panel made the right call. The real world consider memory safety & execution integrity to be critical issues, and C++ no longer to be viable. Without some major improvements -- I would consider this view to be correct.

      • bvinc a day ago |
        > Profiles, which would allow C++ code (or the majority of it) to become type-safe and memory safe.

        Certainly safer, but not memory safe. Operations as simple as multiplying signed integers or popping an empty vec can be undefined behavior which is not memory safe.

        • smallstepforman a day ago |
          For most domains, it is fine. Why should my valued checked code pay the price for checking every arithmetic operation for overflow. Why should my correctly implemented algorithm waste CPU checking something I know is valid? And worst of all, what happens when a logic error is encountered, we run untested code path? I hate code that is conditionally defensive (eg. if (ptr) ptr->critical(); ). I should never be in that situation, a silent ignore corrupts internal state, and never tested the fail path. Ptr may even refer to garbage. Its a stupid defebsive check in 90% of code bases. std::optional<Ptr> at least clarifies intent.
          • crote a day ago |
            The problem is that it silently overflows by default - and a good chunk of the time it is even undefined behavior. Sure, in some situations you as the developer are 100% certain that an overflow is impossible (despite the compiler not being able to prove this and therefore eliminate the checks), but in the vast majority of cases it is a footgun silently waiting to go off.

            Rust tries to solve this by having basic addition panic in debug, while silently-but-consistently continuing in production: overflow is considered a bug, but it is at least not a platform-dependent bug.

            If overflow is expected, then there's checked_add to detect it and fail in a friendly way, saturating_add / wrapping_add / carrying_add for specific overflow behavior.

            Finally, if speed is crucial and overflow is either impossible or you don't care about the outcome whatsoever, there's unchecked_add to explicitly opt-in to a C-like "just do whatever the machine feels like".

            You can still do everything you can with C. It it just an explicit choice, rather than an implicit platform-dependent mechanism you might forget about.

            • tialaramex 21 hours ago |
              > unchecked_add to explicitly opt-in to a C-like "just do whatever the machine feels like".

              Just like for signed integers in C the {integer}::unchecked_add is Undefined Behaviour if overflow occurs. So that's not "whatever the machine feels like" it's much worse.

              This is an unsafe function, so you're expected to write a SAFETY rationale for the unsafe call, and that's your opportunity to justify to a future maintainer why you were sure this addition never overflows. If you find yourself struggling to justify that belief it probably means you should not have used this function.

              If you're going to write guard code for overflows, and use that to justify the SAFETY claim, why not use the existing functions for that? Clippy will suggest this in many cases because it's less likely you will blow your own foot off.

          • UFxESTER a day ago |
            I like the Employees Wash Hands sign. Recent batches of API tools seem focused on sanitizing IO: WebMCP, AI strings, safe native input parse, even Assembly mapping. So in a hot loop (whatever F35 anonymous lambda) you may have data change under you. So on antiquated hardware (like a Voyager I) maybe you want to flash the firmware to 3.5 after 70 years... but Iran has a HELLIOPARSER. It's imperative to be defensive transmitting data streams across the light years.
          • Maxatar 18 hours ago |
            No one is suggesting that every arithmetic operation is checked for overflow. The suggestion is that overflow is not undefined behavior. Getting rid of undefined behavior for overflow does not in anyway require that every operation is now checked, all it requires is specifying that the result of an arithmetic overflow depends on the platform and different platforms might produce different results.
            • dwattttt 13 hours ago |
              Defining the behaviour for overflow in the language doesn't suddenly mean the behaviour is what every program wanted. Fine that it has a defined result, but if that result isn't what you meant when you wrote a+b it's still a bug.

              At a broad view, we get to a place where there's no "bug" when "what happens on overflow" is what the program(mer) wants.

              • Maxatar 9 hours ago |
                I have no idea how to parse your comment or how it relates to what I said.

                All I said is that you can remove undefined behavior from signed overflow without having to introduce checks to every arithmetic operation and without having to specify any particular behavior or outcome. The technical term for this is "unspecified behavior" and the consequence of making overflow unspecified behavior is that the consequences of overflow, while still unspecified, must be bounded in space and time, unlike undefined behavior whose consequences are not required to be bounded in either space or time.

                • dwattttt 9 hours ago |
                  I mean removing undefined behaviour from signed overflow isn't the problem. The problem is that when a programmer previously wrote a signed operation that could overflow, they didn't specify what behaviour they really needed.

                  You can define a behaviour today that they'll all get, but you can't define a behaviour that matches what each programmer needed when they wrote their operation. Some of them can wrap safely. Some of them would need to saturate. Others would need it to abort.

                  The problem isn't that the behaviour is undefined per se, it's that you can't tell afterwards which potential behaviour the programmer needs, and choosing one behaviour e.g. wrap will break everyone who actually needed saturating, or trapping, etc.

      • ho_schi a day ago |
        Yep. Safety and simplicity need to be the priority.
      • MFHava a day ago |
        > Profiles

        Contrary to Contracts, which at least managed to get consensus in WG21, I very much doubt that Profiles will get consensus.

      • guipsp a day ago |
        Profiles are vaporware
  • drivebyhooting a day ago |
    I used to be a C++ programmer but I haven’t done it in a few years.

    I pretty much do all my low level vibe coding in Rust. Is C++ still relevant? What prevents Rust from completely supplanting it?

    • willtemperley a day ago |
      Your Rust very likely runs in a C / C++ environment.
    • anonymous908213 a day ago |
      99.9% of all system code in the world is still written in C/++. It runs your Java, C#, Javascript, Python, PHP, basically every production language that isn't Go or Rust. It runs the two most popular game engines in the world. It runs your phone, server, and laptop, no matter which of any you use. It runs your car. It runs almost every embedded and industrial application on the planet.

      Is it still relevant, JFC. The way people on this forum manage to sequester themselves from reality. Let me reverse the question: is Rust relevant? Mozilla developed Rust, abandoned their Rust browser, and only 10% of Firefox is written in Rust. Maybe 1% of modules in Chrome and Linux are written in Rust, if that. And what of Rust applications written from scratch? Can you name ten applications that have, say, exposure to more than 100,000 users? Impossible mode: they can't be developer tools only used by other developers (uv, ripgrep, etc.), they must actually be applications used by enterprises or consumers.

      • adzm a day ago |
        As a big c++ fan, new projects are generally choosing Rust, which I would agree with, even though I do indeed love C++
      • devsda a day ago |
        I read that as "is c++ still relevant for new features, given Rust and its popularity", not "who is still using C++".

        Personally, I think it is still relevant. Many people thought Kotlin could overtake Java, Java reinvented itself with new initiatives/features and was saved from becoming irrelevant.

        Rust also has the LLM advantage which is where I think the "if it compiles it works" nature of Rust is easier for manual changes and maintenance when needed.

        • afdbcreid a day ago |
          Java vs. Kotlin is a different matter. It's still an open question if C++ even could match Rust's features, not to say if it (the committee) wants to, and the answer seems to be "no".
          • gmueckl a day ago |
            The feature parity question goes both ways: rust won't ever be able to express some things that are possible in C++.
            • afdbcreid a day ago |
              Like?
              • gmueckl a day ago |
                Algorithms that safely mutate the same data structure on multiple threads and do so safely because of some complex algorithmic properties that guarantee that the changes do not overlap?
                • tcfhgj a day ago |
                  Why can Rust not do that?
                  • gmueckl a day ago |
                    How do you create shared mutable ownership of overlapping ranges of a single flat array in rust?
                    • tcfhgj a day ago |
                      similarly except the algorithm to Mutex<[T]> and Arc?
                      • gmueckl a day ago |
                        How does this work e.g. for an array of integers that several workers threads write to at random, non-overlapping positions?
                        • tcfhgj 15 hours ago |
                          1. by implementing your complex algorithm? 2. if they don't overlap, they can't be random, can they?

                          Rust can literally do anything programmatically. Idk why you think it cannot do something.

                          • gmueckl 9 hours ago |
                            They can be unordered, e.g. when reshuffling data into a new buffer based on a permutation that was computed separately. How do you avoid locking the output buffer in rust?
                • afdbcreid a day ago |
                  Rust can do that just fine. https://doc.rust-lang.org/stable/std/cell/struct.UnsafeCell..... "some complex algorithmic properties that guarantee that the changes do not overlap" are exactly the place to use unsafe and encapsulate it.

                  If you mean things that formally create a data race, then C++ cannot do that either.

      • qtqtqt a day ago |
        > basically every production language that isn't Go or Rust.

        Even in their case. Rust depends on LLVM which is wriiten in C++. Go needs libc on some platforms.

    • fancyfredbot a day ago |
      C++ is the third most popular programming language according to TIOBE behind C and python. It's got an 8.87% ranking. So yes it looks like C++ is still relevant. In fact C++ usage has risen slightly.

      Rust is in tenth place with 1.44% ranking, it's rising fast but still has a long way to go before it catches C++.

      I'm not going to speculate about why Rust hasn't yet supplanted C++ but I will say I don't find it surprising.

      • afdbcreid a day ago |
        TIOBE is nonsense.

        But, of course, there is still a lot of new C++ code written, more than Rust. I believe C++ will become legacy, but it's not there yet and even once that happens it'll take at least decades to stop writing C++.

      • miffy900 a day ago |
        Please for God's sake stop citing TIOBE.

        A much more accurate snapshot would be Github - they recently published the top langauges for the year (so far, up til Sept 2026) by distinct monthly contributors and C++ comes in at 9 out of the top 10, and Rust doesn't even place in the top 10 yet, so yes it is highly relevant and prevalent, but not because TIOBE said so.

        But, TypeScript, Python and Rust are the fastest growing languages, in that order, so also you cannot discount Rust.

        https://github.blog/news-insights/octoverse/octoverse-commit...

        • fancyfredbot a day ago |
          You didn't mention why people shouldn't cite TIOBE so I checked. It's because they measure search engine queries to assess popularity. GitHub measures actual code usage in real repos.

          I agree the GitHub methodology seems better. I don't think TIOBE methods mean that it's ranking is completely irrelevant but it'll be noisy and you could easily game it.

        • gmueckl a day ago |
          Github is also skewed because it only captures a subset of open source projects, and open source is realistically a teeny tiny fraction of the world's written code.
          • account42 a day ago |
            Yes, GitHub is heavily skewed towards "hip" projects.
    • gucci-on-fleek a day ago |
      Even if C++ is irrelevant for new code, there's so much software already written in it that we'll be maintaining it for decades to come. I'd argue that Cobol and Fortran have been mostly obsolete for new code for almost 30 years now, yet both are still widely used today, and they've even had major updates in the past decade [0] [1]. And there's even more software written in C++ than there is in Cobol or Fortran, so I don't think that C++ is going away any time soon.

      [0]: https://en.wikipedia.org/wiki/COBOL#COBOL_2023

      [1]: https://en.wikipedia.org/wiki/Fortran#Fortran_2023

      • adgjlsfhk1 a day ago |
        with ai their future seems very uncertain. ports are now very easy, so languages have to stand in their own merits
        • gmueckl a day ago |
          That is a myoptic view. Old codebases often have their value measured in the tiny problems thay were ironed out over the decades and the knowledge that they cover their subject domain correctly. A complete rewrite loses all of this in an instant amd has to start from scratch.
    • jandrewrogers a day ago |
      Essentially all high-end systems code for high-performance and high-reliability systems is still written in modern C++. That language has many attractive properties, including safety features that Rust does not currently support.

      Additionally, for pure performance requirements, C++ is still materially faster than Rust in practice. That may change some day. C++ has many issues but it is also objectively excellent at many things.

      • n_u a day ago |
        > That language has many attractive properties, including safety features that Rust does not currently support.

        Could you expand on what specific safety features C++ has that Rust doesn't?

    • thw_9a83c a day ago |
      > Is C++ still relevant? What prevents Rust from completely supplanting it?

      A highly mature ecosystem with well-established libraries. Especially in certain fields (DSP, robotics, CAD kernels, microcontrollers, etc.), there are no equivalent libraries and frameworks in Rust with such a proven track record.

      Now, LLMs can rewrite those libraries in Rust quite easily. Such options weren't available a few years back. But it's still hard to prove that a rewrite hasn't introduced new bugs. It's easy to demonstrate that a piece of code has bugs, but much harder to prove that it doesn't introduce any new ones.

      • willtemperley a day ago |
        Additionally, even if an LLM-created Rust port of a C++ library was bug-free, an LLM cannot recreate the community that has evolved around the library.

        Take PROJ for example, which is the de-facto coordinate systems library in the geospatial world, mostly written in C++. The processes and trust built up with external organisations like national mapping agencies is irreplaceable.

        That hasn't stopped people trying to vibe-clone PROJ in Rust though.

        • thw_9a83c a day ago |
          > ...an LLM cannot recreate the community that has evolved around the library.

          This is, in fact, an excellent point. You can ask an LLM to expertly clone or re-create any project in a different programming language. But that doesn't make you (or anyone else) an expert in that field, let alone competent in such a new codebase. Slowly developed, painfully debugged projects have a community of human brains who care about the topic. An LLM clone has nothing like that.

    • printer_in_pink a day ago |
      rust depends on C++ (LLVM)
  • imaginit a day ago |
    > contracts. Put simply, a number of NBs believe that this feature is not yet ready for release.

    The ISO National Bodies voted wisely. C++ has had so many ill defined features over the decades and they wanted to avoid yet another one.

    I don't have any skin in the game. I've stayed with the C++11 feature set.

  • Animats a day ago |
    At this point, changes to major programming languages have to adapt to a world in which AI systems generate and change much of the code. C++ contracts may be good or bad, but they are from before strong AI coding systems. So it's time to rethink.

    And we have no idea what AI systems will be doing in 2027.

    • 01100011 a day ago |
      A lot of folks, many of them our most capable programmers, are fighting the last war. It’s like they think AI is going away and we’ll all work like it’s 2019 again.
      • gmueckl a day ago |
        It looks like 2027 orb2028 will be the year when everyone gets so fed up with AI that those "features" will be forced to retreat from under everyone's nose. The stuff will not go away, but there is AI fatigue and it is slowly approaching a tipping point.
        • 01100011 a day ago |
          What makes it go away? People can reject datacenters, AI slop(to the degree they can detect it) and AI search results, but what stops the wave of automation coming for SWEs and IT workers? We are the least able to resist. AI already does a better job than the majority of us. It is, even with much higher token costs, vastly cheaper. So what shoves it back into the box?
          • gmueckl a day ago |
            It won't go away, but people ar getting tired of the UX everywhere force feeding AI "features" to them.
          • colejohnson66 18 hours ago |
            The hatred of data centers and AI is partly a proxy for the working class' growing anger at the ruling class. Crony and late-stage capitalism squeezing every last drop out of people can only go on for so long.
    • ameliaquining a day ago |
      Not to defend the particular proposal at issue here, but my sense is that contract-like things synergize quite well with AI coding, for the same reasons automated tests and static types do.
    • leecommamichael a day ago |
      > So it's time to rethink.

      >

      > And we have no idea what AI systems will be doing in 2027.

      How would you begin to form a plan of how you'll rethink if you can't even see into next year? Isn't it beneficial not to change the languages too much because there's so much training data for the current revisions? AI does not need to be catered to, that is the whole point and why it is useful.

      • Animats a day ago |
        We're going to need languages which both humans and AIs can read and write. We don't know what those look like yet. Contracts aren't a bad idea, but C++ has just become too big. Even people who used to be C++ language lawyers have said that.
        • leecommamichael a day ago |
          Okay.
    • wiseowise a day ago |
      Wow. I’m surprised at the amount of downvotes. Are people really that in denial?
      • Animats 20 hours ago |
        That surprised me, too. This was marked down to -4.
      • anthk 14 hours ago |
        Unreal 6 will ditch C++. So, be prepared. And given the current vuln in Ruby On Rails and ImageMagick, better if the convert everything from IM/GM to FFMPEG to Rust. Oh, and libvirt+Qemu, for sure. That's granted.
  • nukanse a day ago |
    C++ should focus into turning SIMD into a higher level language instead of being a giant collection of intrinsics. Avx code is unreadable.
    • jandrewrogers a day ago |
      SIMD cannot be solved at the compiler level. The capabilities of silicon SIMD implementations are fundamentally so disjoint that code using SIMD requires contextual and platform-specific data structures and algorithms.

      SIMD on different silicon is incompatible at layers of abstraction far above the codegen manipulation a compiler can do.

      • zamadatix a day ago |
        You'll never get the full feature set of all SIMD implementations in a single generic abstraction but I'm not sure that's the only way a SIMD abstraction could provide value. There is a pretty consistent set of narrow SIMD that behaves close enough to consistently get better performance across generic targets with high level abstractions better than auto vectorized scalar code but worse than platform tuned SIMD.
        • jandrewrogers a day ago |
          The subset of SIMD that translates is so narrow that it is almost useless in real code. That’s the problem. Additionally, it is invalid for the compiler to redesign your data structures.

          The ability of compilers to use SIMD is no better than it was 20 years ago. Total stagnation for all practical purposes, and the reason is that compilers fundamentally lack the context and freedom to rewrite the code architecture appropriately for SIMD optimization (even if they could).

          I think a point people miss is that highly optimized SIMD code is almost never about parallelizing loops. It is about deeply probing and manipulating arbitrarily complex data structures in parallel that involve collections of unrelated types. SIMD allows you to do this, and it is fantastically efficient, but a compiler has no conceivable way of understanding this.

          For this reason, SIMD optimization has often been classified as an AI-Complete problem in computer science.

          • smitherfield a day ago |
            Couldn't SIMD features include marking data as "the compiler is free to rearrange"?
            • bluGill a day ago |
              Only in the trivial cases where the compiler already knows that. Data used inside a single function can already be rearranged. Data that is used across more than one function can be rearranged only in the case where the compiler can prove the function is only used in the one translations unit (that is files). If data is used across translations units, there is no way for the compiler to talk with the compiler of the other translations unit to agree on the data rearrangement.

              There is some effort in whole program optimization which can solve the above problem in theory. However I don't know how well it works in practice.

          • throwaway17_17 a day ago |
            My imagination is failing me, can you give me an example of the type of work being done where SIMD is ‘deeply probing and manipulating arbitrarily complex data structures in parallel that involve collections of unrelated types’? I don’t doubt you know what you mean, but I can’t wrap my head around it.

            For me I can only think of the simplest example of SIMD being used to ‘parallelize loops’ as what SIMD is for. If it turns out I’m missing a large problem or application space for SIMD I will be excited to research it. Any pointers to topics would be appreciated.

            • AlotOfReading a day ago |
              One example is OLAP databases, which often heavily exploit SIMD for query processing. You can also turn parsing into a SIMD problem, which is applicable to things like handling XML, JSON, and CSV. Simdjson comes to mind, or parabix for XML.
              • throwaway17_17 a day ago |
                The parsing stuff I am aware of, but the query processing is a big blank for me to dig into.
            • jandrewrogers a day ago |
              SIMD is often used to evaluate complex data structures in parallel. A common case is given a row with an arbitrary mix of data types and a query with an arbitrary mix of independent constraints on those data types, to evaluate all of the constraints in parallel in the same SIMD instruction(s).

              The idea that SIMD is only good for parallelizing operations over arrays of the same type is empirically false and seriously understates the capabilities of good SIMD implementations. Some SQL-ish implementations work this way on row-structured data.

              Most devs seriously underestimate what good SIMD is capable of.

              • throwaway17_17 a day ago |
                Thanks for the response, I’ll have some reading to do in this area.
            • bajard 19 hours ago |
              I wrote an example answer, but it was shadowbanned
          • zamadatix a day ago |
            Portable SIMD works well for me today, not sure why you're unable to find any use cases for it?
        • gdwatson a day ago |
          Is the common feature set described anywhere online? I am not in the SIMD world, and I am curious about the state of it. But I am not so committed that I am wiling to learn several different platforms’ SIMD implementations in order to suss out their commonalities.
          • zamadatix a day ago |
            If you want something pretty generic and easy, check out WASM's SIMD. They limit things to 128 bit widths and common operations so it can work across generic WASM targets rather than be the most efficient on x86 specifically or something.

            Other targets and languages have portable SIMD targets that are a bit more advanced, but I think WASMs SIMD design is the best for generically getting your feet wet.

      • bajard a day ago |
        That's why it needs a lot of work. Writing SIMD in c++ is like writing assembly.
      • wahern a day ago |
        > SIMD cannot be solved at the compiler level.

        ISPC doesn't a pretty good job of it: https://ispc.github.io/

      • janwas a day ago |
        Please stop repeating this ludicrously overstated claim.

        I have personally seen several hundred use cases for SIMD that are just fine with portable intrinsics, and NOT always "platform-specific data structures and algorithms". Sure, that does happen, but not fundamentally, nor even often.

        To be clear, I agree the compiler isn't solving the data layout problem for us, but portable intrinsics are indeed useful.

        gemma.cpp uses them, and last I checked, has much faster long-context prefill and decode vs. llama.cpp. They hand-roll the intrinsics and presumably it is harder to land optimizations repeated across 7+ implementations/instruction sets.

    • nurettin a day ago |
      There are frameworks trying to unify simd/avx, but the abstractions aren't free. At this point, we need better hardware and low level interfaces, not better abstractions.
    • jfultz a day ago |
      In fact, C++26 made some considerable progress on that front.

      https://en.cppreference.com/cpp/experimental/simd

      An implementation of which exists in the following GitHub repo (albeit implemented in the xvec::simd namespace rather than std::simd...but otherwise intended to be spec-compliant).

      https://github.com/intel/xvec

      Speaking as a long-time C++ developer...I wasn't uninterested in contracts (which I've known about since the days of Bertrand Meyer flogging them in Eiffel), but I agree with the sentiment here that the SIMD efforts were considerably more interesting.

    • MathMonkeyMan 6 hours ago |
      There is std::valarray, but a google search said that only Intel's implementation uses SIMD. See [cppreference][1].

      [1]: https://en.cppreference.com/cpp/numeric/valarray#Notes

  • aldanor a day ago |
    Approval of runtime failures essentially failed at runtime
    • em-bee a day ago |
      hmm, i rather think this is implementation time, pre commit. it failed the tests.

      runtime would be after commit when the standard is released and moved to production and users fail to make their code with the new features work.

  • jdw64 a day ago |
    But I'm curious—why did DIS fail this time with C++26? Weren't feature additions in C++ usually plentiful?

    But they say this is the first case where a DIS failed during the standardization consensus process. Why is that?

  • lowatt a day ago |
    > By voting “no,” an established system, one based primarily on trust and respectful collaboration, has been shaken.

    I don't get it. If ISO deliberately requires two levels of approval, why should exercising the second level's voting authority be considered a betrayal of trust?

    • dannyw a day ago |
      I don't get it either; and have no sides on the fence (been years since I wrote C++; but I have before).

      It sounds like there's sufficiently different genuine views here on whether it's right for the standard at this time, and this seems like the process working as designed.

    • adastra22 a day ago |
      Because they didn’t vote the way the author wanted them to.

      That’s not very charitable, but honestly I’ve been trying for five minutes now to find or think up an alternative explanation. And coming up blank.

      • Pannoniae a day ago |
        A more charitable interpretation is something like royal assent for laws. Yes, the king/queen can always just choose to delay it or even block the law, but that'd be unprecedented and the whole system of parliamentary monarchy would be in a serious crisis.

        I think the author is trying to get at like, the actual discussion happens earlier / on the WG21 level, and the ISO vote is treated more of a rubberstamp. And that has changed in this instance.

        • bigstrat2003 a day ago |
          Personally, I think that if a system to veto something exists, it shouldn't be considered shocking or a betrayal of it gets exercised. Otherwise why have the system?
        • locknitpicker a day ago |
          > but that'd be unprecedented

          Not really. The unprecedented part was how come contracts proponents decided to push a proposal against all feedback and concerns, knowing very well it was falling to build up any form of consensus.

          Contracts proponents knew for years the featured proposal was opposed as it was riddled with fundamental technical flaws. The unprecedented part was the way they said "screw them" and pushed forth anyway, hoping the formality would build enough pressure to force anyone opposing the feature to succumb to the bureaucratic pressure and silence their concerns.

          This contracts stunt reeks of corporate chicanery. I mean, what was the plan here? Ignore everyone, get the bureaucratic foot in the door, and then blackmail all dissenting voices of sabotaging the process if contracts proponents didn't had their way?

          • leni536 a day ago |
            "Any form of consensus": there was obviously consensus in WG21, hence contracts remained in the draft.
            • locknitpicker a day ago |
              > "Any form of consensus": there was obviously consensus in WG21, hence contracts remained in the draft.

              Contracts have been systematically pulled from the drafts since C++ 2020 as their proponents decided to ignore technical feedback and opted to go for political petty tactics much like those we see today.

              Ask yourself this: how come the contracts proposal has been floating for so long, changed so little, have no reference implementations that address any remarks, and you still see the half baked proposal being floated?

              And WG21 members did voted against it. Contract proponents repeatedly try to dismiss critics as having been ignored due to the nature of the democratic process, and now are complaining that they themselves see the same democratic process rejecting the proposal yet again, this time after the unprecedented push.

              • leni536 a day ago |
                > And WG21 members did voted against it.

                Not most recently, when it was first voted in, then repeatedly voted to remain in when the option to remove it was polled. The most recent consensus of WG21 is reflected in the current draft, established by multiple votes overwhelmingly in favor.

                • BlackFingolfin a day ago |
                  But receiving a majority vote is not the same as building a consensus. I think that's the sticking point here.
                  • leni536 a day ago |
                    It wasn't voted out of the blue. There was extensive discussion prior to votes (including weekly telecons for months solely dedicated to contracts). So how do you measure consensus if not by a vote after extensive discussion, leaving everyone to voice their opinion, come up with alternatives and propose polls?

                    And sustained opposition does not necessarily mean lack of consensus either. WG21 heard the opposition and decided that constracts belong in the proposed draft despite of that opposition. It is very rare that a new feature does not get opposition, even a sustained one.

                    Now it is clear that there is no consensus between WG21 and the national bodies (although they overlap), but there is clear consensus within WG21.

                    • BlackFingolfin a day ago |
                      The definition in ISO/IEC Guide 2 for consensus is this:

                      > Consensus: General agreement, characterized by the absence of sustained opposition to substantial issues by any important part of the concerned interests and by a process that involves seeking to take into account the views of all parties concerned and to reconcile any conflicting arguments.

                      So to me it is not at all clear that there was consensus within WG21.

                      John Spicer, the former chair of SG21 (the C++ Contracts Study Group), also seems to have doubts about that, see <https://open-std.org/JTC1/SC22/WG21/docs/papers/2026/p4381r0...> -- which is quite self-critical.

                      Don't get me wrong, I am not taking sides here (I haven't even done any work in C++ in the last 10 years), but it does seem a bit more complex than how you paint it.

                      • locknitpicker a day ago |
                        > So to me it is not at all clear that there was consensus within WG21.

                        Not only was there no consensus, reports from the process described the behavior from contracts proponents in WG21 as political maneuvering and trying to ignore criticism by pretending that somehow consensus was not a goal and thus they could simply nominwlly reject and ignore any criticism.

                        There's a lot of personal attacks directed at Stroustrup but somehow it's left out of the story the fact that Microsoft apparently criticised the proposal as unimplementable. We're talking about feedback from the dominant compiler vendor.

                        • MFHava 19 hours ago |
                          > Microsoft apparently criticised the proposal as unimplementable. We're talking about feedback from the dominant compiler vendor.

                          It's implemented in GCC mainline, it's implemented on a branch of Clang. Considering MSVC: at this point in time I'm not convinced it it a question of implementability, but of will: https://cppstat.org/de/?tags=cpp26&type=lang

                      • leni536 a day ago |
                        I appreciate that ISO/IEC tries to provide some definifion of consensus, but it's so vague that is borderline useless. Who decides what is "important" or "substantial"? Do we need an other round of consensus for that (making the definition circular)? Or is deciding what is "important" or "substantial" part of the process that is outlined in the second part of the definition (making the first part more or less redundant)? Or is it the opposition to decide if their presented issues are "important" (making it effectively a veto power)?

                        As for the second part of the definition, regarding the process, that all took place with a measurable outcome. Although "reconcile any conflicting arguments" might be interpreted as unanimity, but that's surely not the intent.

                        • locknitpicker 21 hours ago |
                          > I appreciate that ISO/IEC tries to provide some definifion of consensus, but it's so vague that is borderline useless.

                          Is it though?

                          I mean, in what world does the concept of consensus means it's ok to ignore all opposing remakes, criticism, and objections?

                          You have a proposal for the C++ standard which representatives from companies such as Microsoft rejected after describing it as being unimplementable, and knowing this it's supposed to be fine to push forward with it?

                          What was the plan here? Are these guys so out of touch that they thought petty political chicanery would compensate all the technical problems?

                  • bluGill a day ago |
                    At some point a minority needs to accept they have lost.

                    I've been following contracts for a while and my interpretation is some people are refusing to accept that others disagree with them. These people are repeating the same arguments that have been addressed multiple times.

                    You can disagree, but I look at it as people refusing to work with others voting no.

                  • jcranmer a day ago |
                    The vote for incorporating contracts into C++ was 100 in favor to 12 against.

                    Consensus is not the same as a majority vote. But it also doesn't mean that a small minority gets the right to block the feature forever.

      • locknitpicker a day ago |
        > Because they didn’t vote the way the author wanted them to.

        That's my opinion as well. It's a smear campaign lashing back at people who dared to point out flaws.

    • krautsauer a day ago |
      The Section "The Process" does explain the thinking behind that statement. To rehash: The author thinks that NB's were trusted with the ability to reject by blocking minority for the case that there is new information, but have used that ability in a case where there was no new information.

      I have no stake in this entire discussion or C++ and don't know if the premise of this argument is even true. Just curious: is that thinking unhinged?

      • crote a day ago |
        Note that the author says that this was "the previous practice". There is no mention of this being, say, the sole intended use as mentioned in some bylaws. In fact, if "uncovering of new information" was the sole reason, why not have a confirmation vote in the same body after a mandatory cooldown period?

        The author even explicitly states that "errors in the process" are another potential reason for the NB's to vote against a proposal, so why focus solely on the "no new information" argument?

        Also, keep in mind that the WG21 operates primarily by consensus[0], which is explicitly not a majority vote. The final vote for Contracts was 114 in favor, 12 opposed, 3 abstaining, which some consider "an unusual level of opposition" with "tangible debate"[1].

        I assume the default is for people to trust that the domain experts in the various subcommittees did their work properly, so an in-favor vote would be more a "I trust the subcommittee / I don't care about this feature" than an explicit "I approve of this feature", with an opposing vote basically being "the subcommittee is making a grave error, this is obviously going to blow up in our faces".

        Extend this to the NB level, and the disapproval is basically a vote of "Wait, do we really want to standardize something which is still facing very serious opposition?"

        [0]: https://isocpp.org/std/standing-documents/sd-4-wg21-practice...

        [1]: https://componentsprogramming.com/cpp26-croydon-wg21-meeting...

    • kllrnohj a day ago |
      Because the second level isn't really involved, they are a formality. This isn't unusual, it happens when the range of things a group does has grown so large that it needs to be primarily managed by dedicated subgroups but the rules don't update to delegate all authority to that subgroup.

      The members of the broader group that cared strongly about C++ would have just been involved in the WG21 subgroup in the first place, the subgroup that approved it with a 2/3rds majority. So it almost certainly means that a broader group of ISO that normally don't care about what C++ does (and hence aren't involved in WG21) were influenced to vote in the direction the minority of the WG21 wanted.

  • Zepto8537 a day ago |
    major C++26 features, including reflection, std::execution and library hardening, are also delayed because they were included in the same draft.
    • dzogchen a day ago |
      No they are not. The standard may be delayed but most compilers ship these features already.
      • bluGill a day ago |
        They are shipped experimental and most people will not use them. Even those who use them will limit use as they have been burned before by something experimental changing when it was finally stable.
  • nanolith a day ago |
    While I can understand that C++ contracts were met with controversy, contract annotations scoped at analysis time that can be verified by external tools, such as static analyzers, model checkers, or automatic theorem provers, are incredibly useful.

    I put together an alternative function contract and invariant mechanism in C using CBMC and custom macros that effectively allows me to perform formal methods in C using compositional verification. The reason why I chose C is because of its relative simplicity and relative ease of building tooling around it. C++ contracts provide some feature parity, and would let me take advantage of some of the features in C++ relative to C.

    I hope that the contract proposal is workshopped and simplified so it can be proposed again for a future version. Its current form is unsuitable, but it deserves a second chance with a simpler implementation. Contracts would narrow the safety gap between C++ and languages such as Ada / SPARK.

    • twhitmore a day ago |
      Contracts are useful, but don't guaranteed anything if type safety & memory safety can be bypassed.

      I think the ISO panel made the right call. The real world consider memory safety & execution integrity to already be critical issues (and C++ no longer to be viable), and they are correct. The WG has its priorities wrong.

      • uecker a day ago |
        Memory safety can also be bypassed in Rust. If you want something where memory safety is guaranteed, use Fil-C but this comes at a performance cost. Or use formal verification, where then contracts can help (but C++'s complexity doesn't).
        • tkz1312 a day ago |
          I was surprised to discover recently that C++ is in a pretty nice sweet spot for verification (at least at the binary level), where it has some useful type system features, but will get out of your way and generate simple ASM (without e.g. spamming bounds checks and panics everywhere as rust does).
        • saghm a day ago |
          This is like responding to someone saying that someone can die from an getting shot accidentally by a gun by saying you can also die from drinking too much water. Both of them are technically true and do happen on occasion, but one of them is not nearly as much of a risk in most circumstances, whereas the other is pretty much inherent to the most basic way of using it.
          • uecker 20 hours ago |
            No, I do not think that this is comparable. This just the annoying exaggeration I complain about. In reality, one can write fairly safe C code, while Rust code in practice is also far from perfectly safe and also introduces new supply chain risks.
            • saghm 20 hours ago |
              I don't agree at all.

              > one can write fairly safe C code

              In practice, pretty much every C/C++ codebase in existence has ended up having memory safety issues, even very widely used ones with a lot of scrutiny over the years.

              > while Rust code in practice is also far from perfectly safe and also introduces new supply chain risks.

              You're conflating "does not have one notoriously dangerous type of safety issue" and "does not have any safety issues", which is a disingenuous characterization of what I said. You were the one who introduced the comparison to memory safety in Rust and C++, and now you're moving the goalposts as an attempt to rebut my disagreement.

              • uecker 20 hours ago |
                I know you disagree. But I am not conflating anything. You just claim that C is unsafe and any issue we see is obviously evidence for this, while Rust is safe and any issue we see does not change this. But there is no logical argument here that makes sense. In reality, projects in both languages see issues in practice, and to decide whether the safety is much better in one or the other can only be decided by a careful analysis based on some risk model. Note that I do no deny that Rust has an advantage with regard to memory safety (and instead a huge supply chain problem), I am just saying the advantage is massively exaggerated (and the arguments are largely based on unfair comparisons and bad statistics).
                • uecker 19 hours ago |
                  A comparison which would be more accurate in my opinion is to look at driving in the 1960: Not much have built-in safety and no compulsory seat-belts (we see many issues with C/C++ projects, often very easy to fix). One can also even claim that no driver can safely control a car in all circumstances ("not even experts can use C safely"). Yet, with modern cars and regulations, driving is much safer today than it was and can be considered reasonably safe (modern C code and modern tooling). Rust proponents claim we must give up driving with cars completely because it too dangerous (all the accidents are clear evidence) and we must switch to trams as it is impossible to steer them into some objects (and even though there are also still accidents, trams have "steering safety" and rule out a whole class of driver errors).

                  You don't have to agree, but this is how I see it.

                • saghm 17 hours ago |
                  > But I am not conflating anything. You just claim that C is unsafe and any issue we see is obviously evidence for this

                  That is explicitly not what I'm claiming. You seem to think that I think "memory safety" is equivalent to "safety", which is what I've repeatedly told you is not what I'm saying. That's conflation. It's not clear why you'd expect me to read more details you give after repeatedly ignoring what I'm saying and putting words in my mouth that I'm not saying, so I have to assume at this point you're posturing for other readers rather than actually trying to communicate with me in any reasonable way.

                  • uecker 17 hours ago |
                    I do not think there are other readers in this thread anymore for which I could posture. You are right that I should not introduced other safety issues into the discussion. Still I am not following. Clearly contracts allow one to guarantee memory safety of a function. The original argument was that this does not count because there are ways around it, to which I responded that Rust also has ways around it. Your point seemed to be that the risks are vastly different and I think this is an exaggeration.

                    But maybe I am still not getting your point correctly.

                    • saghm 16 hours ago |
                      I do think the risk of memory unsafety is vastly different in Rust and C++, and it's confusing to me that this is up for debate. Even a novice Rust programmer can easily avoid ever using the unsafe parts of the language by just not typing the word "unsafe", and it's very straightforward to configure things so that any use of them in your own code is rejected. On the other hand, in practice even proficient C/C++ programmers still will write code that ends up with memory safety issues; there were two new CVEs published for use after free in Chrome just yesterday.

                      Yes, there can be compiler bugs that cause unsafety in safe Rust code, and it's possible to have unsafety in dependencies that leads to issues in code that otherwise looks safe, but this can happen in C++ as well. My point is that the risk of having memory unsafety from bugs that you write in your own Rust code is effectively zero if you don't ever use the unsafe keyword, and this is how most Rust code is written in practice. Most C++ code is not written in a way that produces anywhere close to this level of confidence because the language fundamentally does not support anything like that. I don't think that contracts would fundamentally change this.

                      • nanolith 14 hours ago |
                        > I don't think that contracts would fundamentally change this.

                        On their own, no. What contracts provide are annotations for how the programmer expects the code to behave, which can be verified by model checkers or automatic theorem provers. These can already verify memory safety properties; borrow checking only does a subset of what a model checker can do. To scale model checking up so it can work on a large codebase, compositional verification is required. Contracts enable compositional verification, which in turn allows developers to write code safer than what is possible with vanilla Rust or Java.

                        I do this today with C. The model checked C I write is safer than software written in Rust without a model checker. It is memory safe, and it is verified to work within the specification that I have designed. As far as the specification is correct, it is correct.

                        We can't rewrite the world in Rust. There are many billions of lines of code in C and C++ that aren't going away. Instead, we need to find ways of making this code safe with as little change to it as possible.

                      • uecker 7 hours ago |
                        But this is always comparing apple and oranges: "theoretically, a user can completely avoid memory safety issue in Rust by never using unsafe or problematic dependencies" vs. "in practice C/C++ still often have memory safety issues".

                        In practice, we also still see memory safety issues also in Rust code exactly because people use "unsafe" or have a dependency that does. I also see that practical impact of memory safety issues in well-maintained C/C++ code is almost zero on my personal security (rare, often mitigated or extremely difficult to exploit). And after the LLM wave of issues is processed, this will be even less a problem. I am far more scared about supply chain issues (and I bring this up as comparison for proper risk assessment, not to move away the discussion from memory safety).

                        Then, theoretically, one could also make sure C/C++ have no memory safety issues. (And I have done this myself in toy programs and industry also for larger projects, so this is not even purely theory.) The languages does not fully support this yet, yes, but why does this matter so much? The language / compiler / good coding standards still support reducing memory safety issues to low levels - which is relevant, because outside of theoretical scenarios, this is what Rust also achieves in practice (and not perfection in getting rid of memory safety issues).

                        And then now in this thread, this argument that in C/C++ it is more difficult to achieve perfect memory safety was even used as argument against a feature that would be a step towards making this easier. This I find completely misguided.

                        (I am not talking about compilers bugs).

      • nanolith 17 hours ago |
        Any language is viable if appropriate engineering is applied to it. There are many billions of lines of code in C and C++. This software needs to be made safer, and it is not possible nor viable to rewrite it all into a different language. Hence, we need to dig into CS and PL theory to find ways to fix this software that does not incur significant investment, does not require retraining software developers in a new language, and does not result in a "big rewrite in the sky" style project.

        Contracts are annotations, much like types are. What makes contracts powerful is the tool that examines this annotation, as is the case with types. A type checker, such as an H-M type checker, can only perform limited checks. It's possible to use a dependent type checker with dependent types, but this is undecidable, and it requires a proof assistant and human guided tactics to resolve. In practice, this is expensive, and when automation such as LLMs are used, one currently gets tactic soup that is difficult to understand, which defeats the purpose.

        A model checker, such as CBMC or ESBMC, can work with contracts to verify specification that would be difficult to verify without contracts. Model checkers can already verify memory safety and even the absence of memory leaks across an entire program. However, model checking grows exponentially expensive as we add more code to be verified. Contracts give us the ability to perform compositional verification, which allows us to verify codebases into the millions of lines of code or larger by breaking down this verification into many small model checks, stitching these together with contracts and invariants. Contracts and invariants complement type checking and significantly extend it. It's possible to use contracts and invariants to add these checks to an untyped language or a minimally typed language such as C. If my precondition includes the data invariant, "property_valid_widget(x)", then effectively, this also type checks x. This works even if I've completely erased the type and later recast it.

        The "real world" doesn't currently have a solution for reducing general software safety issues -- which goes far beyond memory safety -- other than formal methods. Practical and efficient ways to formally verify software is within our reach, and is already being done with other languages. I do this today with C / CBMC using contracts and invariants. I get memory safety, specification safety, and a guarantee of no memory leaks. This can also be done with C++, Rust, Java, and other languages using similar techniques. While it is true that Rust and Java both have basic memory safety in place, they also both can harbor vulnerabilities that could be resolved with function contracts and model checking.

        Contracts are more than useful; they give visibility of developer intent to model checkers and similar tools. This visibility makes software significantly safer than borrow checking or type checking can alone.

    • uecker a day ago |
      C and formal verification is an awesome combination. I tried cmbc on some toy programs, it it fully automatically proved memory safety and all assertions. But for larger programs one has to split up with a contract-like facility.

      Can you tell us more how you use cbmc with macros? I am also exploring this.

      I also wonder what feature from C++ you miss in C?

      • Surac a day ago |
        Well i you ask me i miss namespaces and functions i could put into struct and enum types
      • nanolith 17 hours ago |
        I did a talk on this at BSDCan 2026:

        https://www.bsdcan.org/2026/timetable/timetable-Model-Checki...

        That link has the slides and some example code. There's also a live stream on YouTube.

        Regarding features I miss from C++, I like the concept of generics. I don't like the implementation in C++. I also find C's _Generic facility to be limited, especially when building containers that perform hygienic type erasure. This feature isn't enough for me to go back to C++ on its own, but it is something I'm exploring in a new language I'm writing.

    • locknitpicker a day ago |
      > contract annotations scoped at analysis time that can be verified by external tools, such as static analyzers, model checkers, or automatic theorem provers, are incredibly useful.

      Yes they would be.

      Except that's not the contracts that they tried to force down C++'s throats.

      The current contracts proposals features things like throwing exceptions in contract predicates, leaves out basic features such as function pointers, and not to mention that the contract specification alone covers around 5-10% of C++ specification and still glances over most details as being implementation defined.

      As everyone is attacking Stroustrup as this master mind behind this opposition, perhaps people should devote some time to read one of the many papers pointing out the many flaws in the proposal. Stroustrup himself features as the coauthor of a few of them. Why is this not a technical discussion but a witch hunt?

      • materielle a day ago |
        As somewhat of an outsider, the C++ spec process seems really strange to me.

        It’s weird that major features are designed from start to finish without even having so much as a demo.

        It feels like there should be a back and forth process between committee proposal -> experimental impl in a major compiler -> community feedback, and so on.

        It sounds like it’s basically the waterfall approach to language design? They write a glorious spec and chuck it out to the world, and hope that compilers can implement it and people actually find it useful. Example: modules.

        • locknitpicker a day ago |
          > It’s weird that major features are designed from start to finish without even having so much as a demo.

          Not necessarily. In broad terms, Boost is considered a staging ground for features proposed to C++. Compiler projects also keep up with the standards.

          In this case the concept guys continuously dropped the ball on this requirement though. One of the papers pointing the many flaws in the proposal calls out this shortcoming, where contracts have neither a workable reference implementation nor an adequate specification. In fact, they handwaved a lot over details with vague calls to "implementation-defined".

      • MFHava 14 hours ago |
        > contract specification alone covers around 5-10% of C++

        I have no idea where you read that but it is a blatant lie - easily disproven by the way: N5046 which is pretty close to the C++26 DIS has 2668 pages. P2900R14 has a total of 114 pages, of which ~56 pages are dedicated to proposed wording.

        Wording is presented as a diff to the working draft and contains extensive copies of the existing text that is either amended, modified or removed. (Aka: there are no 56 pages of wording).

  • thefourthchime a day ago |
    I have no idea why anyone would work in C++ in 2026. If I had to work on an existing codebase, I'd just have Claude rewrite it in Rust. It's always been a miserable, awful mess.
  • shevy-java a day ago |
    C++ is in a strange position.

    If you look at "let's use AI to rewrite xyz in Rust", then C++ has to wonder why it isn't as often mentioned compared to Rust here. I am not saying AI should be the future, but merely compare why Rust is cited here more frequently than C++. That's just one of many other things. Rust also got popular due to crates. How is the alternative called in C++? Barely anyone outside the C++ community knows. And that's also a problem.

    C++ isn't going away anytime soon, of course, but when people keep on mentioning alternatives again and again then it shows that the competition intensifed a lot.

    • thatxliner a day ago |
      > How is the alternative called in C++?

      what is it though? vcpkgs/decentralized repositories?

      • filipdobro a day ago |
        It is de facto vcpkg
      • smallstepforman a day ago |
        With package managers on Linux, BSD and Haiku, the only odd man out needing packages is Windows, and vcpkg fills this gap so its no longer an issue.
    • scotty79 a day ago |
      Why would anyone want to rewrite anything in C++ given they can choose anything else? Like Rust or Go or C or Zig or literally anything else.
      • filipdobro a day ago |
        Compiler stuff in MLIR.
      • nananana9 a day ago |
        I wouldn't choose Rust because of compile times. C++'s aren't great either, but with discipline in how you structure headers, you can get them down to a pretty reasonable place. Unsafe Rust is also a bit of a PITA, and I have cases where I care lot about precisely how memory is laid out and accessed, I'd have to resort to it quite a lot. I don't love crates either, they smell a bit like node_modules and all big Rust projects I've seen have hundreds of them. Most C++ libraries are self contained, by nature of not having an easy way to declare dependencies.

        I wouldn't choose Go because GC is a non-starter.

        I wouldn't choose C because it's nice to have some form of generics or metaprogramming, even if templates are not exactly fantastic.

        I wouldn't choose Zig because the language isn't stable, and the lead developer has hinted that they'll drop LLVM down the line, and I don't want to beta test their compiler backend.

        • tnodir a day ago |
          Zig drops LLVM for debug mode only.
      • drnick1 a day ago |
        Because, used sensibly, C++ is a better C. This is more or less what C++98 was, and even that is probably too much.
    • jeroenhd a day ago |
      I think Rust's saftey guarantees are an important reason to throw it at LLMs. LLMs make stupid mistakes, even the very best ones, and a lot of them, all the time. Having a compiler reject those mistakes makes for a better automated process. C++ has some safety mechanisms as well, but they're weak and fragile compared to Rust.

      For people with C++ experience working together months at a time that doesn't have to be a problem, but AI rewrites turn a million lines of one language into a million of the other in a day, followed by an impossibly short human review.

      Rust also isn't as safe and correct as you'd hope it to be for "fuck it, let the LLM deal with it" style programming, but it's got the best speed-usability-safety balance out of the common languages if you don't trust your programmers.

    • gmueckl a day ago |
      Hacker news has always been a rust bubble. Tallies of opinions voiced here are always skewed in some ways.
  • Sophira a day ago |
    This article makes it sound the options are normally approval, rejection and abstention, but that this time round a fourth option, "disapproval", was reached. It that the case, or are they just trying to say that people rejected it?
    • smitherfield a day ago |
      It was rejected because it did not receive the required 2/3 majority for approval.
    • stevage a day ago |
      I took it as the individual votes are approve/reject/abstain, and the outcome of the process is approve/disapprove.
    • bombcar 20 hours ago |
      It’s also sounding like they’re arguing the ballot should have been a foregone conclusion in which case why have the vote at all?
  • scotty79 a day ago |
    Honest question.

    If I want to spin up a new project with a coding agent to explore some idea and I'd like the bare metal performance, why would I choose C++ over Rust?

    I could choose TypeScript over Rust if I wanted it to be html first or I could choose Go if I wanted it to be clear of the complexity of memory management or I could choose C# if I wanted it to have best interface with windows stuff or I could choose something Erlang VM based for resilience and multithreading.

    But what reason might I have to pick C++?

    • banjoisbanjo a day ago |
      Maybe you don't. If you were to spin up a new project with a coding agent most of the subsequent highlights of the languages you cited might also not matter.
    • weitendorf a day ago |
      Interfacing with other C++ projects or leveraging existing infrastructure/work you've done.

      Rust's package management and lack of stable, high-quality libraries maintained by professional or even just generally known entities are a pretty big problem. For the small number of Rust projects I've attempted, I've tried to make them zero-dependency, and it worked (you just ask agents to implement more libraries) but it added a lot of annoying overhead.

      It's also just easier to write high performance code in C/C++. If you'd rather have that than builtin memory safety guarantees or whatever else you want out of Rust, or have a small enough surface for errors/threats that you can just manually spend time validating that your code is safe and secure, C++ is still pretty good IMO. I would generally start with C though, because it makes interop with other languages easier

      • tcfhgj a day ago |
        > Rust's package management and lack of stable, high-quality libraries maintained by professional or even just generally known entities are a pretty big problem.

        IMHO, Rusts package management is the opposite of a problem.

        And a lot of stable high quality crates exist, such as Tokio, thiserror, chrono, axum, .......

        • weitendorf a day ago |
          I have nothing but respect and warm feelings for developers who choose to create and maintain software packages and make them available for others.

          The problem is that I need to be able to trust my dependencies' provenance. Not just that the developer is good, but that this particular version is good, and that all their dependencies are good and that their versions are good. If there is a security issue in something I use, I need to know that the people responsible for maintaining it have the time and resources to be aware of the problem, quickly patch it, and make the fix available to me; because of that, I also need to regularly check my dependencies' new versions for security fixes and upgrade to them as patches roll out. But I don't have the time to closely review or investigate all of those, so I need to trust that they're handling it without knowing them personally.

          Worse, if there is only a single or small group of part-time maintainers handling a package, it would be very easy for a malicious release to be made either unilaterally for financial gain, or unintentionally by some credential hijack (some script pushes a new minor version, they might not notice), or a supply chain hack (eg their build environment got pwned->the software they distribute is not the software they intended to send).

          So I prefer to only use 1P packages, dependencies from a well-resourced brand or known figure with something to lose, or dependencies I know very well (and I only have time to know a small number very well). Has nothing to do with the quality of the packages or the developers' skill.

          • tcfhgj a day ago |
            > But I don't have the time to closely review or investigate all of those, so I need to trust that they're handling it without knowing them personally.

            so either you pay someone to do the work for you or you hope that someone does it for free?

            • weitendorf 19 hours ago |
              yeah that's basically my point. People who maintain crates don't work for me and it wouldn't be reasonable to assume any kind of responsibility for keeping my stuff secure, unless there was some big fancy standard library or runtime pushed by a major corporation or public figure that was committed and capable of doing so. So I implement my own rust libraries (just the parts I need, mostly asking agents to do it) because it's the most cost effective way for me to trust my supply chain.

              But I wouldn't have to do that as much in languages with larger standard libraries or more established libraries/tools/ecosystems (eg abseil in C++, numpy and tensorflow in python).

    • creata a day ago |
      If a coding agent is writing code for you, telling it what language to use is micromanaging. It might use Rust, it might use C++, it might use both. If it's writing the code, it probably has a better idea than you have for what's appropriate for that code.
      • jasomill 20 hours ago |
        Only if you don't intend to maintain, debug, or even understand what the code is doing.

        Or at least not without the benefit of more capable coding agents than you used to create it.

        And only if the coding agents in question can be trusted to not deliberately or accidentally fail to provide you with critical information ("Now that you mention it, the program does occasionally POST the contents of ~/.aws/credentials to a web server. As this produces no output, I didn't consider it relevant to your question about whether it correctly outputs the string 'hello world'.").

      • scotty79 16 hours ago |
        When I didn't tell it what to use, recently it used VB (mixed with Python). Not ideal.
  • fithisux a day ago |
    Maybe it's time for C++ community to create maintenance releases of old standards?

    Not new features necessarily, but fixes or backports that fix major flaws.

    It can also complement old standards. If a C++23 feature can be supported in C++98 or C++11, it should go to that standard with an update.

    • varjag a day ago |
      How would that even work? Implementations that’s been compliant for years suddenly become non-compliant?
      • fithisux 20 hours ago |
        C++98.1
    • account42 a day ago |
      That already exist - C++ defect reports can change the behavior of implementations for older standards.
      • fithisux 20 hours ago |
        Could be new versions C++98.1
  • Surac a day ago |
    I disapprove what they do to c++ for many years now, but nobody cares. I had hoped for c++ what has become c#. Well now i use c# with c if i need the speed
  • orphereus a day ago |
    How did C/C++ get into ISO? Why are they "special" compared to other languages? Just because they are old and ubiquitous in all systems programming?

    The whole design committee procedure around these languages feels like a bureaucratic nightmare, again compared to other languages, especially Rust.

    • smallstepforman a day ago |
      It makes big companies and gov bodies happier since and code investment is guaranteed to run with competitors tool chains. You’re not locked in to one vendor, it is an international spec.
      • colejohnson66 18 hours ago |
        Until you want to do something as simple as export a function from the dll/so. The syntax and stdlib may be standardized, but that's not enough to make a language portable.
    • bobmarleybiceps a day ago |
      I think before I was born, there was just a ton of (closed-source) C compilers for different systems. So people were like "we should have a standard, so our safety critical application doesn't break when we decide to use a <new hardware vendor's> C compiler."

      I also think since compiler infrastructure has improved so much, and everything is open source now ... so idk if it matters as much anymore.

    • drnick1 a day ago |
      > Why are they "special" compared to other languages?

      The world basically runs on C.

    • ricardobeat a day ago |
      Isn’t Rust also suffering from committee deadlock for the past couple years?
      • tcfhgj a day ago |
        Could you expand? You seem to know more
        • ricardobeat 13 hours ago |
          I don't actually, not a Rust user. Just something I've read about.
    • jll29 a day ago |
      There is no need for a language to be "special" just to get standardized.

      The main driver is a group of people willing to submit the necessary documents to ISO (or national bodies like ANSI or DIN or even IEEE, and then ISO may also adopt existing standards as theirs).

      COBOL, FORTRAN and Pascal are all ISO Standards [1,2,3].

      [1] https://www.iso.org/standard/74527.html

      [2] https://www.iso.org/standard/82170.html

      [3] https://www.iso.org/standard/13802.html

    • cestith 20 hours ago |
      There are a number of ISO-standardized languages.

      https://en.wikipedia.org/wiki/Category:Programming_languages...

    • anthk 14 hours ago |
      1) C is no C++, C89 and C99 are good enough for legacy/embedded systems. Also, C is the Ur example for anything. The golden standard. Like English for business and STEM. Not the best language, maybe, but it runs everything technical.

      2) C++ it's a monster which should died long ago.

      3) Go should take the role of small tools such as some services and mail/IRC clients, especially for CLI/TUI. Or stuff like urlview. Rust the big ones (media encoding, PDF libraries, browsers...)

      4) Unreal 6 will ditch c++. Good riddance.

  • swiftcoder a day ago |
    This is fascinating to watch from the outside, because there was a big debate a few years ago about whether rust should go for ISO certification, and the consensus seemed to be it was a massive bureaucratic headache with few upsides. Not having a lot of insight into ISO procedures, I wasn't sure what to make of that, but this certainly gives some weight to that point of view
    • jmyeet a day ago |
      The other way to look at this is that the standards committee was correct in rejecting this proposal because it added too much complexity without sufficient benefit. If so, hasn't the committee provided value?

      I'm not arguing one way or the other (for C++ or Rust) but it's certainly worth considering.

      I believe AI is the final nail in the coffin for C/C++ although it'll be a long, slow decline. C++'s backward compatibility with C cannot be resolved and you can never really be sure about memory ownership let alone safety. C++ in particularly is simply too complex. I didn't trust people to write correct C++ before AI without severe restrictions (eg Google's guidelines). I certainly don't now.

      • Sharlin a day ago |
        (The Committee approved contracts as part of the C++26 DIS (Draft International Standard); it was the NBs (National Bodies) that didn’t. Because the Committee is made of NB representatives, the NB vote is usually just a formality. The situation is similar to a parliamentary committee spending many years drafting a major bill that’s ultimately rejected by the full parliament even though everybody assumed it would have the required (super)majority support.)
      • swiftcoder a day ago |
        > The other way to look at this is that the standards committee was correct in rejecting this proposal because it added too much complexity without sufficient benefit. If so, hasn't the committee provided value?

        The problem appears to be that they didn't have the majority needed to reject it at any of the previous points in the process, so we've now ended up with a stalemate where neither the Ayes nor the Nays can actually execute their position effectively

  • mihaaly a day ago |
    > Now it gets complicated.

    It was said in the article about the process.

    But to me this is relevant to the state of the language itself.

  • hollowonepl a day ago |
    I'm not surprised. Pace of adding new features vs. realistic added value, vs. complexity to get it properly standardised makes 3 years rounds to circulate new ISO C++ standard less and less possible without introducing major flaws that will continue sending C++ to hell in the eyes of Rustafarians and other safe languages folk.
    • muvlon a day ago |
      A 3-year cycle is not the problem, the pace of new features is. C++14 vs. C++11 for example was a totally reasonable upgrade and well-paced. C++26 vs. C++23 is a huge change by comparison. Everyone has their own opinion about which fancy complicated language feature will finally "fix" C++ (concepts? contracts? reflection? profiles? constexpr?) and the answer of WG21 has been to just put all of them into the already full kitchen sink.

      You can fix every problem in language design with more language features, except "too many language features". Most people on the committee even seem to intellectually understand this, but their preferred time to stop adding new major features is "once my pet feature is in".

      And to harp on the safety thing a bit: In the absence of an actually safe subset of C++, additional language complexity is also a safety problem. "best effort" safety like the stuff C++ is pursuing at the moment still relies on you knowing exactly what your code does, which is hindered by complexity.

      Here's an example for contracts. Say you have the following declaration:

          void foo(int* p)
            pre (p != nullptr)
            pre (*p >= 0);
      
      What happens if you pass a nullptr? You'd guess that it either raises a contract violation or silently ignores it, right? Yes, those are two possibilities, in the "enforce" and "ignore" modes respectively. But there's also an "observe" mode, where the preconditions are checked at runtime and violations reported but then execution resumes normally. Can you see the problem? Passing a nullptr causes evaluation of the second precondition to deref it, so we get UB from the contracts themselves before we ever hit the function body (which might have its own, classic nullptr checks, who knows). This is a completely new class of footgun that you never had with assertions (they are always either enforced or ignored).
      • leni536 a day ago |
        While the observe semantics example is somewhat scary, it isn't the end of the world. It is more than likely that `foo` dereferences p in the function body anyway, so the UB in the precondition is inconsequential.
  • account42 a day ago |
    The NBs should use this veto power more often until the committee learns to not push half-assed features into the standard. C++ is not a language that needs to "move fast and break things".
    • locknitpicker a day ago |
      > The NBs should use this veto power more often until the committee learns to not push half-assed features into the standard.

      This half-baked contracts proposal has been systematically cut out of the draft since at least 2020.

      I mean, how long does it take to fix it? Perhaps it's unsalvageable?

      Their proponents seem to be more interested in playing political games than to fix the mess they presented. Apparently they don't mind sabotaging the C++ standardization process to get their way.

    • jcranmer a day ago |
      I find it amusing that of all of the half-assed features in the standards, it's contracts that causes the vote to fail. I've seen firsthand how the standards committee just fundamentally disempowers anybody from actually objecting to a feature, and yet contracts is the one feature where all of those objections were heard at length, entertained repeatedly, and survived because the small coterie of a dozen or so people were unable to convince the other hundred people of their objections. The C++ committee process is deeply broken, and yet contracts is the one major feature where that process wasn't broken.
      • rerdavies 19 hours ago |
        Is it unreasonable to draw a lesson from previous half-assed features that failed after ratification, and say enough is enough?
        • jcranmer 17 hours ago |
          Given that all of the objections are explicitly over contracts, and only contracts, and not any of the other half-assed features in C++26, I don't think it's fair to say that that lesson isn't being drawn.
  • zerr a day ago |
    Can we have a 10 year break from further language changes?
    • nxobject a day ago |
      Or, at the very, least a rule that a proposed feature should be a vendor-specific extension for at least 5 years, and the vendor has to dogfood it in their toolchain.
      • bluGill a day ago |
        Vendor specific extensions never get widespread use. Nearly everybody wants the ability to build their code with whatever compiler their customer has. There are a few exceptions who will use a vendor specific extension (microsoft), but the majority get scared that they depend on something that limits the future and so won't use it.

        Internal use only is helpful but doesn't get the feature used, and too often leaves things not useful for a toolchain but useful elsewhere out.

  • tonyhart7 a day ago |
    why would any startup or company would care about C++ committee do ???? isn't this is hampering innovation ???

    they can just simply use Zig or Rust no ??

  • wseqyrku a day ago |
    > As I understand it, this step would mean reverting to C++23 and proceeding to C++29

    What kind of design process is this

    • MFHava a day ago |
      That's just a misunderstanding, probably rooted in a pre-published paper that claimed so.

      In reality WG21 could just decide to start work on C++29 based on the failed C++26 draft (or the current working draft has already incorporated some C++29 changes)...

    • locknitpicker a day ago |
      > What kind of design process is this

      It is not. This is a lame attempt scaremongering, to try to inflate the consequences of contract proponents not getting their way. It's like sore losers threatening to take the ball home to prevent everyone from continuing to play the game, and claiming that taking the ball home is how games are normally played.

      In practice, the standard passes the moment the sticking points are ironed out. This likely means cutting out contracts yet again, which has been done every single release since at least C++20.

      • bluGill a day ago |
        Contracts were never in C++23 - C++26 was the goal when they cut it from C++20. The C++ cut was done by the people pushing contracts, while this is done by a different group.
        • locknitpicker 21 hours ago |
          > Contracts were never in C++23

          Why yes, because the C++20 was so poorly thought through that in the July 2019 WG21 meeting the design was deemed irremediably broken, and consequently the committee made the unprecedented decision to just disband the group and start over by forming a new one. This happened so close to the kickoff that contracts were right there excluded from C++23.

          And after all these years, the proposal remains broken.

  • devnull3 a day ago |
    Here is what I propose:

    1. Start a new version (lets call it v2) with clean slate.

    2. Retain the re-usability of v1 code in v2 in the same manner as FFI (i.e v2 code will wrap v1 code). But it will be much more smoother as it will be designed in v1 in mind.

    3. Leverage AI to make the transition to write this v2 -> v1 code.

  • lewdwig a day ago |
    Maybe C++ overthought the generality of the feature and under-delivered on the MVP (a common committee failure mode). Two keywords such as "always-enforce" and "build-configurable" for assertions would have covered the vast majority of what people wanted from contracts.

    Also from a procedural perspective the technical committee was wrong. It is supposed to send drafts to DIS when there is consensus. They did it based an a plenary vote. That is not what consensus is, and also not how ISO defines it. Consensus is the absence of sustained opposition. Contracts never had consensus, DIS simply responded to that procedural snafu.

  • snvzz 10 hours ago |
    The way forward is to remove contracts and try again.

    The proponents of Contracts can then polish their proposal and try again.

  • Woodi 9 hours ago |
    Current contract proposition is quite stupid.

    It's just another syntax for 'if' and sentence in spec that they wish it for "program bugs".

    Some languages have pre/post conditions and use it for wrapping function call with pre/post functions that do something. Useful in Emacs when you can tweak your config a bit. But do not crash application.

    Some languages have condition that limit when function/method is called eg. for x > 5 is called one function and for rest numbers another function. Useful, cost runtime check but do not crash app. eg. your F35 in the middle of the air...

    And from all possible things they choose to do plain asserts crash...