The next version of C++ may miss its deadline at the end of this year due to a failed vote on international standards. A dispute is brewing among developers over “Contracts.”
Bjarne Stroustrup, the creator of C++, is one of the opponents of implementing Contracts in their current form, reports The Register. Contracts let developers define conditions that must be met before or after a function runs. In addition, assertions can verify assumptions during execution. The feature is intended, on the one hand, to detect programming errors and, on the other hand, to reduce the risk of undefined behavior.
The feature has been debated for more than a decade. An earlier implementation of Contracts was removed from C++20 following concerns about its design. A new proposal, known as P2900, is facing resistance from Stroustrup and other prominent developers. They argue that P2900 adds unnecessary complexity and hasn’t been sufficiently tested. According to its opponents, it would undermine the language’s performance-oriented design.
Other developers disagree. They point out that the Contracts design has repeatedly enjoyed majority support. Developer Andreas Fertig notes in a blog post that rejecting the proposal at such an advanced stage undermines confidence in the standardization process.
The draft C++26 standard failed to receive sufficient support in a vote by the International Organization for Standardization (ISO). Although 13 national standards bodies voted in favor, 9 voted against and 12 abstained, the number of votes against exceeded the permitted threshold of 25 percent.
Harry Bott, CEO of the C++ Alliance, sees the failed vote as proof that the ISO’s approval process is working properly. After all, national standards bodies can challenge proposals before they are adopted.
Unusually late rejection
However, a rejection at such a late stage of the standardization process is unusual. This could mean that the next version of C++ will not be finalized until sometime next year.
The controversy arises against a backdrop of growing concerns about memory safety in C++. Programming errors can cause vulnerabilities, prompting some organizations to consider alternatives such as Rust. Contracts could help detect certain errors, but they do not guarantee memory safety.
The ISO C++ Working Group WG21 is meeting in Búzios, Brazil, to decide how to proceed. One option is to remove Contracts from C++26, although this would require adjustments to library enhancements that already depend on this functionality.
Another possibility is to continue developing Contracts separately, while the rest of the standard moves forward. The committee could also revise the proposal and organize a new vote.