C++26 Disapproved

4 days ago (andreasfertig.com)

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.

  •     > 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?

    • 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

      8 replies →

  • Your comment just made me realize contracts is different from concepts (which are basically bounded genetics, right…?)

    • 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.

      10 replies →

    • 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.

      8 replies →

    • A concept is a compile time requirement that bounds templates which are the generics in C++, so you are close.

  • 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.

  • 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.

  • 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.

    • 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.

      1 reply →

    • 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.

      12 replies →

  • [flagged]

    • > The problem is that a bunch of people who didn't care for them did something very extreme by voting against approving C++26.

      The only extreme and tone deaf thing I see in this story is how contracts proponents were faced with multiple papers demonstrating quite clearly and extensively how they were broken in specification and in form, but still tried to ignore all the criticism and force them through a consensus process in spite of being clearly opposed.

      How does this make any sense? What was the plan here? To blackmail the C++ community to accept a broken feature under threat of the proposal not passing?

      Make it make sense?

      What I want to see is the people who tried to force contacts upon the process in spite of all opposition to come forth and explain their rationale. It was highly absurd and even unthinkable to force a broken feature down C++'s throats with bureaucratic chicanery, and then complain that the same bureaucracy has mechanisms to stop it's abuse. I for one would like to hear an explanation.

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.

  • 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.

    • > 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.

    • I think you're confusing it with Concepts. Contracts are basically just asserts, nothing to do with templates.

    • Some do bother, e.g. Microsoft Office uses modules, there is a talk on it.

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.

  • 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?

    • Well i you ask me i miss namespaces and functions i could put into struct and enum types

    • 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.

      1 reply →

  • > 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?

    • 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.

      1 reply →

    • > 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).

  • 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.

    • 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).

      11 replies →

    • 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.

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

  • 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.

    • (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.)

    • > 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

    • eh in rust you could just say it's a different edition, and claim that totally incompatible codebases are the same language

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.

  • Maybe a slightly faster std::regex or whatever it's called; apparently it's horrendously slow for no benefit.

    • 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.

      10 replies →

    • 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.

      9 replies →

> 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.

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".

  • > 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.

  • 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.

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.

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?

  • 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?

  • I took it as the individual votes are approve/reject/abstain, and the outcome of the process is approve/disapprove.

Approval of runtime failures essentially failed at runtime

  • 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.

> 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?

  • 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.

  • 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.

  • 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?

    • 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...

  • 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.

    • 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.

      15 replies →

    • > 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.

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++?

  • 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

    • > 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, .......

      5 replies →

  • 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.

    • When I didn't tell it what to use, recently it used VB (mixed with Python). Not ideal.

    • 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'.").

  • 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.

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.

  • 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.

    • > 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.

      8 replies →

    • > Profiles

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

  • > 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.

    • 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?

      2 replies →

    • > 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.

      2 replies →

  • 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.

    • 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.

    • 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.

    • > 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.

    • > ...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.

      2 replies →

C++ should focus into turning SIMD into a higher level language instead of being a giant collection of intrinsics. Avx code is unreadable.

  • 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.

    • 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.

      13 replies →

    • 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.

    • That's why it needs a lot of work. Writing SIMD in c++ is like writing assembly.

  • 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.

  • 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.

The way forward is to remove contracts and try again.

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

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.

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?

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.

  • 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.

  • 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.

    • 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.

      1 reply →

    • Because, used sensibly, C++ is a better C. This is more or less what C++98 was, and even that is probably too much.

  • Hacker news has always been a rust bubble. Tallies of opinions voiced here are always skewed in some ways.

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...

major C++26 features, including reflection, std::execution and library hardening, are also delayed because they were included in the same draft.

  • No they are not. The standard may be delayed but most compilers ship these features already.

    • 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.

      1 reply →

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.

  • 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).

    • 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.

> As I understand it, this step would mean reverting to C++23 and proceeding to C++29

What kind of design process is this

  • 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)...

  • > 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.

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?

  • 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.

    • 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.

      1 reply →

Can we have a 10 year break from further language changes?

  • 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.

    • 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.

Maybe my reading comprehension has just nosedived but I could not find where this article discusses what the heck Contracts refers to?

  • 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

    • 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.

      1 reply →

  • 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.

> 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.

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.

  • 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.

  • > Why are they "special" compared to other languages?

    The world basically runs on C.

  • 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.

  • 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.

    • 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.

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.

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.

  • 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.

    • 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.

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?

  • 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

  • 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.

    • > 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?

  • 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.

    • 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...

      3 replies →

    • 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++.

  • > 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.

    • 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.

      1 reply →

  • 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.

    • 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.

      12 replies →

    • > 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.

    • As a big c++ fan, new projects are generally choosing Rust, which I would agree with, even though I do indeed love C++

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.

- 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++?

  • > - 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.

  • 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?

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.

  • > 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.

    • 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.

      1 reply →

  • 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.

  • 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.

    • 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.

      3 replies →

  • Wow. I’m surprised at the amount of downvotes. Are people really that in denial?

    • 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.

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 ??

Time to cancel the project. C++ acquired sufficient set of features over the years, becoming very PL/I-esque.

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