WG14 prepares for C Change

WG14 prepares for C Change

The C programming language nudged a little closer to its next version this week, with the publication of a proposed set of revisions to the standard. WG14, the committee in charge of the second most popular language on the planet (as of November) published a working draft introducing a range of changes that it expects to roll out.

Jens Gustedt, a core contributor to the C standard, explained some of the key changes to the language that would appear in the next revision in a blog post yesterday.

This will be the first revision since C17, the 2017 update which Gustedt described as “a pure bug fix release”. The next release, slated for final publication in 2022, is called C2X, and WG14 is working from a preliminary charter published in 2016.

The alterations are mostly conservative, consisting of clarifications where existing language seemed vague. They include a change to the semantics for the volatile keyword, bringing it in line with existing practices in C, along with a clarification for the specification of FLT_EVAL_METHOD. The changes also clarify how C will deal with wide character encoding, the evaluation of alignment specifier expressions, and make the use of the restrict keyword less ambiguous.

The one change that WG14 has declared as major in its revisions is a change to the static_assert declaration. It has moved to harmonize the declaration with its implementation in C++17, which simplified its usage by eliminating its mandatory inclusion of string literal messages.

“Given that it is not uncommon to share header files between C and C++ code, and that static_assert declarations are used to guarantee specific conditions are met that may vary between implementations, harmonizing the syntax of this declaration with C++ would be useful,” said the documentation proposing the change. “Clang already implements this feature in C as an extension.”

While the already-accepted changes are mostly for clarification, Gustedt would like to see things go further before the document is finalised. Changes that he hopes for include easing the definition of extended integer types, extending the concept of integer constant expressions, revising the memory model, improving array bound propagation and adding a simple specification of nullptr, similar to C++.