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

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.