C23 is shaping up: New keywords and fixed assert to land in updated standard

C23 is shaping up: New keywords and fixed assert to land in updated standard

Another virtual meeting of the C programming language working group has come and gone, and with at least another get-together before its draft ballot time, C23 is really taking shape.

Project editor JeanHeyd Meneide made good on his promise to keep developers updated on major changes and took to Twitter to share the latest enhancements for the upcoming version of the C standard. According to Meneide, recent discussions have led to typeof(...) becoming a standard, call_once turning mandatory, and including unreachable() for optimization purposes.

The update will also tackle memset, a function seen by some as the “most dangerous function in the C world”, by making ={} its official replacement. Other than that true, false, bool, and thread_local will turn into keywords with the release, so shouldn’t be used to name things like custom variables anymore, while @, $, and the back-tick symbol will become part of the source character set.

Starting with C23, the way declarations and definitions were described in the first edition of Kernighan and Ritchie’s The C Programming Language won’t be a thing anymore, turning ANSI declaration and definitions into the only option. The update will also sport a fix for assert, which allows the function to take (...) as input and therefore simplify things when passing it something that can be interpreted as multiple macro arguments.

The assert fix will also make its way into the next edition of the C++ standard. C++ developers will by the way find quite a few familiar bits making their way into C this time, such as the __has_include feature (C++17), or the newly decided-on _Noreturn attribute for informing the compiler that a function won’t return a value. The feature was first introduced into C++ with the 2011 update. 

In previous C23 meetings, ISO/IEC JTC1 SC22 WG14 already decided to add some more shorthand preprocessing directives, apostrophes as digit separators, and a fundamental type for N-bit integers to the next update of the programming language. Calls to get developers invested in the lambda proposals meanwhile don’t seem to have helped much, as the addition is said to not be considered for C23 anymore. 

Including lambdas at a later date might be still an option. The C standards body however depends to a certain degree on existing practice and therefore implementation work from compiler teams, so those interested in the feature really have to get involved in order to make it happen. 

An in-depth summary of the recently decided additions is promised to land soon. The final version of the C23 standard is planned to be released in 2023 (as the name suggests).