3 min read

The ISO C++ Committee met last week at Cologne, Germany to complete and publish the Committee Draft (CD) of the next C++ standard called C++20. This standard will bring some of the game-changing advancements to C++ including modules, concepts, coroutines, and ranges to C++.

Here are some of the changes made to the draft in this meeting:

Contracts moved out of C++20

A contract specifies a set of preconditions, postconditions, and assertions that a software component should adhere to. The committee unanimously decided to move contracts out of C++20 and defer it to a later standard because it has recently gone through major design changes. They were unsure of the impact or implications of these changes as they did not have much usage experience with contracts.

In short, contracts were just not ready. It’s better for us to ship contracts in a form that better addresses the use cases of interest in a future standard instead of shipping something we are uncertain about in C++20. Notably, this decision was unanimous — all of the contracts’ co-authors agreed to this approach,wrote the committee.

To continue the work on contracts a new study group is created named SG21. It will be chaired by John Spicer from Edison Design Group and includes all original authors and members who are interested to work on contracts.

std::format, a new text formatting API

One of the key advantages of the ‘printf’ syntax is its familiarity among developers. However, it does suffer from a few drawbacks. The format specifiers it provides like hh, h, l, and j are redundant in type-safe formatting. They can unnecessarily make specification and parsing complicated. The printf syntax also does not provide a standard way for extending the syntax for user-defined types.

C++20 will come with a new text formatting API called ‘std::format’ that aims to offer a flexible, safe, and fast alternative to (s)printf and iostreams. Based on the syntax we see in Python, the .NET family of languages, and Rust, it uses ‘{‘ and ‘}’ as replacement field delimiters instead of %.

The C++20 synchronization library

This new standard will bring new improved synchronization and thread coordination facilities. It will support efficient ‘atomic’ waiting and semaphores, latches, barriers, atomic_flag::test, lockfree integral types, and more.

The next step for the committee is to submit the draft to all the national standard bodies to gather their feedback. The committee plans to address their feedback in the next two meetings and then publish the C++20 standard at the February 2020 meeting in Prague.

Developers are excited about the new features C++20 will come with. A Reddit user commented, “Wow, the C++ committee is really doing a great job. There are so many good features coming into the standard (std::format, constexpr features, better threading support, etc, etc). Thank you all for all of your hard work.

Others are not very impressed by the ‘web_view’ proposal. This introduces a facility that aims to enable natural, multimodal user interaction with the help of existing web standards and technologies. Another user added, “Very surprising, I didn’t expect that because personally, I think that the proposal is not very good. If we use JS and other technologies to display stuff, why not directly use those languages? Why go through C++? But maybe I don’t understand it; I’ll make sure to go through the minutes.

You can read the full report posted by the ISO C++ Committee for more details.

Read Next

ISO C++ Committee announces that C++20 design is now feature complete

GCC 9.1 releases with improved diagnostics, simpler C++ errors and much more

Code completion suggestions via IntelliCode comes to C++ in Visual Studio 2019