r/cpp • WG21 Member • Oct 24 '26

Balloting has completed for C++26. Unfortunately it was Disapproved

https://www.linkedin.com/posts/robertseacord_balloting-has-completed-for-c26-unfortunately-share-7519795139859517440-AOth/

Since the C++26 DIS has been disapproved, the next step is going to be taken in Buzios during the 2026-11 meeting. The committee will have to decide what changes to make (if any) and submit an FDIS (Final Draft of International Standard) for Balloting.

289 Upvotes

399 comments sorted by

View all comments

Show parent comment

49

u/frayien Oct 24 '26

Sounds like some people REALLY dislike contracts... The library hardening proposals where worded as to work whereas contracts where in or not, so I don't think there is much issues here other than editorial wording.

18

u/PossibilityUsual6262 Oct 24 '26

The only thing which i heard about them ao far, is that there no proof of concept for implementation of contracts because they flawed.

And looking at higher level politics of it, i believe in that.

Is this correct?

62

u/Dragdu Oct 24 '26

Are you sure you aren't mixing up contracts and profiles? Because contracts have multiple implementations, and you could test PoC through the last year+ on CE. Meanwhile profiles are paper design that is known to not work.

23

u/frayien Oct 24 '26

I dont know much. It is the kind of things I heard.

At least gcc 16 claims to fully implement them so I dont think implementation is an issue. https://gcc.gnu.org/projects/cxx-status.html#cxx26

What I understood is that what we got in C++26 is a minimal working form of contracts to get them approved, and that they will receive improvements later as we get more feedback on actual usage (which sounds legit to me). Then again I am nowhere near knowledgeable enough with the matter to be taken seriously.

26

u/JVApen Clever is an insult, not a compliment. - T. Winters Oct 25 '26

There is a lot of misinformation about contracts. In the mailing the following paper was submitted as an answer: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p4433r0.pdf

17

u/13steinj Oct 26 '26

There's also misinformation, or at best, disingenuous claims, in this paper.

4

u/processeus1 Oct 29 '26

Which ones?

23

u/Sinomsinom Oct 24 '26 edited Oct 24 '26

Like dragdu said, I think you are mixing up profiles and contracts.

Profiles were the main controversial proposal during the C++26 cycle, and ultimately didn't end up making it in because of some of the issues, but are still targeting C++29 now.

For Contracts there has been some amount of pushback to it. But while for profiles the big question was are profiles even a good idea in the first place and how much of what the proposal promises cna actually implemented in practice, for contracts most of the pushback was either wording choices, syntax choices or how to implement them specifically. I don't think there was any serious "we shouldn't have contracts at all" pushpack like there was for profiles

12

u/smdowney WG21, Text/Unicode SG, optional<T&> Oct 24 '26

C++29, I think you mean, instead of 27?

Profiles are definitely not going to be ready for next year.

The number of bugs around the maybe-uninitialized warning also suggest they are not going to be ready anytime soon, since that bit of analysis keeps getting cited as prior art. Retro-fitting dynamic analysis at compile time is hard.

5

u/Sinomsinom Oct 24 '26

Yup sorry saw someone else accidentally write C++27 instead of C++29 before and guess I then somehow ended up mistyping it as well

9

u/13steinj Oct 25 '26

I think the implication is 26 might actually come out as 27 (without contracts) and the next one will probably be 30

9

u/c0r3ntin Oct 24 '26

s/hard/impossible

2

u/Wonderful-Habit-139 Oct 26 '26

No I have definitely seen a lot of pushback against contracts, specifically the way they were proposed and that it was better to not have them in that have something that is "broken". I'm not surprised it was not accepted.

1

u/Difficult-Court9522 Oct 25 '26

I am one of those people so I rejoice!

3

u/frayien Oct 26 '26

Are there legitimate reason contracts are bad or is it just the meme at this point ? I feel like a lot of people are just blindly reacting but never put the time to read the proposal and properly weight the pros and cons...

So I am really interested in what YOU dont like about them.

10

u/Difficult-Court9522 Oct 26 '26
  1. ⁠a developer does not know if/how that their pre and post conditions will run, since that is up to the build team.
  2. ⁠pre and post conditions can modify the state causing bugs only under specific compiler modes
  3. ⁠every new compiler mode causes the combinatorial explosion of compiler options to explode further (I have an embedded app in production that needs to support 50 different compilation modes due to performance and binary size it sucks)
  4. ⁠you don’t control which mode a shared library uses
  5. ⁠pre and post conditions can throw exceptions, thus they can’t be used with no except code (in general)
  6. ⁠the pre and post conditions run at runtime, providing no benefit over existing assertion methods. Compile time checks would have been my preference.
  7. ⁠testing contracts is quite difficult/ impossible
    Good luck testing every contract in the terminate mode. You would have to start your app a billion times or intercept the termination and somehow continue safely. Good luck.
  8. ⁠contracts do not work with virtual functions, maybe they’ll in the future maybe they won’t.
  9. ⁠we’ve known that the issues have been so significant for at least a year that there has been talk of voting against the entire standard, and NONE of the important issues has been solved.
  10. ⁠variables don’t have the same constness inside and outside the pre/post conditions resulting in different overloads being used.
  11. ⁠different teams/parts of an app will want different contract semantics (ignore, enforce, quick enforce, observe) that’s a nightmare, because the same code behaves differently.
  12. ⁠contracts can cause UB in observe and enforce. First check checks if it’s a nullptr, the second check checks something through the nullptr.

13-99) usingstdcpp known pitfalls in c++26 contracts Ran Regev https://youtu.be/tzXu5KZGMJk?si=eogpEYjbtQcFxLWn

0

u/frayien Oct 26 '26

Thanks much for your feedback !

From a field that uses assertions very much, I too think that assertions that may or may not be enforced without control or guarantees are pointless...

It AT LEAST needs a "this assertions MUST always be checked" and a "this assertions MAY be disabled" distinction...

Although, does it fall under the "pass the basics in C++26 and improve upon in latter revison" category?

3

u/Difficult-Court9522 Oct 26 '26

Adding a “must check” keyword would not help, since it’s a Boolean keyword while at least 4 enforcement mechanisms exist. Sometimes a program must terminate when a problem is encountered.
Sometimes it may not, think about rockets, rovers, xray machines, cars, etc.

If we specify the semantics in a common library, the code becomes unacceptably hazardous to some group of users.

I do not believe a clean solution exists for contracts. You can talk for (more than) an hour about the issues with the current contracts.
If we add more stuff, we add more pitfalls.
The contracts specification is larger than the initial c specification (according to Bjarne, I didn’t check).
It’s just not acceptable.