ISO C++ Standards Committee completes technical work on C++23

ISO C++ Standards Committee completes technical work on C++23

The convener and chair of the ISO C++ Standards Committee, Microsoft software architect Herb Sutter, says the technical work on the forthcoming C++23 – the successor to C++20 – is complete. The focus was on what Sutter called “fit-and-finish” issues and no features were added or removed from C++23. The standard is still subject to an approval ballot but is set to be published later this year.

As C++20 was completed just before worldwide lockdown, in February 2020, Sutter called C++23 the “pandemic edition”. Key new features mentioned by Sutter include:

  • module “std”: enables the standard library to be imported as a module instead of header files, by the addition of two modules, std and std.compat
  • “if consteval,”: execute statements if the context is constant-evaluated
  • Explicit “this” parameters: the first parameter of an non-static member function can be an explicit object parameter denoted by “this”
  • Overload subscript operators with multiple arguments: makes it easier to work with multi-dimensional arrays
  • Extended lifetime for temporary objects in the for-range-initializer until the end of the loop

There are many more new features and a complete list, with links to the papers that describe them, can be found here.

In general C++23 is about small improvements rather than major changes. Sutter described it as “completing C++20.”

Work on C++26 proposals also took place at the recdent committee meeting, including work on contracts and parallelism.

When will these features be available? C++ has a three-year cycle for the standard, but actual availability of features is down to compiler developers, with many new features appearing before full standardization. As the list above shows, most of the new features in C++23 are already implemented in GCC and Clang. Microsoft’s Visual C++ compiler trails behind.

C++ remains among the most popular programming languages, ranked 7th in the Redmonk survey, for example. That said, there is intense interest in safer alternatives such as Rust and Go. In addition, the Google-sponsored Carbon project aims to provide an experimental successor to C++, the rationale being that C++ has too many legacy features and evolves too slowly. That said, the “small improvements” in C++23 will be well received by developers.