Home United States USA — software C2x Will Be the Next ISO Standard for the C Language

C2x Will Be the Next ISO Standard for the C Language

219
0
SHARE

Expected to be finalized in 2022, the C2x standard has started its evolution, driven by the C committee. InfoQ has got the chance to speak with Jens Gustedt, who is working within the committee to advance the new standard and author of the upcoming book Modern C.
Expected to be finalized in 2022, the C2x standard has started its evolution, driven by the C committee. InfoQ has got the chance to speak with Jens Gustedt, who is working within the committee to advance the new standard and author of the upcoming book Modern C.
Gustedt has recently summarized the outcomes of the committee’s work up to the present moment, which led to the publication of the first working draft of the new standard. Other than the work which went into the current C17 standard, mostly aimed at bug fixing, C2x will contain normative changes to the language aimed to improve it.
What are the main goals of the upcoming C standard? What will drive C evolution?
The development of the new C standard follows a charter that fixes the main objectives. The major point here is that the standard is meant to describe existing practice, and not to invent per se. Whenever possible, invention should happen in the field, either in existing C compilers or come from other programming languages (de facto, mostly C++). That said, there is also a lot of activity to cleanup existing features, chase ambiguities in the wording, smooth the edges, and to add missing minor features that could facilitate every day’s coding practice.
What kind of changes shall we expect in the language? Could you provide a few examples of new features in the language that you deem significant?
At the language and library level, the part that is directly visible to programmers, not much is decided for now. We are really open to see what people bring in. My expectation is that we will see some C++ features to be integrated into C, such as attributes, compile time constants for all data types in one form or another, and perhaps initialization-induced types (AKA C++’s auto feature). Also there is a coordinated initiative with C++ for a new calling convention that could supersede the crude errno error return convention that we are dragging with us since the beginning. There are several people that ensure liaison with the C++ committee and they do an excellent job on these issues.
But the C standard has another important role because it basically sets the machine model on which our computer architectures and also other programming languages build. The C standard calls this the “abstract state machine”. As an important feature here we have already voted the integration of the latest IEEE floating point specifications into the C standard. We also have formed a working group to revise the “memory model”, that is how programmers may or may not directly interact with the bare representation of data in the computer’s memory, how this may influence possible optimizations, and how such byte- and bit-level fiddling can be made safe and secure. This work follows Peter Sewell’s (et al.) papers on “pointer provenance” and we hope that we will end up with a memory model that is a suitable common ground for the diversity of system software and applications that C serves.
Recently, native languages (as opposed to interpreted or JVM languages) have been experiencing great attention, including Rust, Swift, Dart, Go &endash; let alone C++, which is keeping up with its steady evolution. Could you frame shortly the kind of use or application domain where you see C specifically excel?
The most important strong points of C are efficiency, portability and stability. Whenever those are the main concerns in software development, C should be considered as a primary choice.
Efficiency: Here, efficiency can mean very different things: energy and memory efficiency (for small or portable devices, satellites), runtime efficiency (for mid or large-scale compute intensive calculations), or speed (for scientific visualization, games or network communication). C’s efficiency in these fields is mostly unmatched, other programming languages tend to introduce a lot of memory indirection, dynamic behaviour, and bloat that kills efficiency in the egg.
Portability: C’s abstract state machine is meant to be portable to about any computing device. This concept has payed off very well: one of the first software components that is usually developed for new CPUs (or for added features to an existing specifications) is a C compiler. Thereby, code written in C, in particular OSes and other system software, is rapidly ported. New architectures can be bootstrapped at low cost. And a huge amount of software projects profit from this: Linux distributions are collections of thousands of software packages that are ported mostly easily to new architectures and that keep pace with the developments of the existing mainstream platforms.
Stability: The C committee puts particular effort into guaranteeing the stability of the code base of our users. Deprecations are rare and marginal. Correct C code that you write now will still compile and run with very little effort 20 years from now; code that has been written in the 80s or 90s still kicks today. Also C has a limited set of features that should be mastered at graduate level in any good engineering school. So maintenance can be ensured over years and even decades. “Legacy” can have a very different taste with C: good C code can be a real asset and must not be a burden.
Gustedt works at the French National Institute for Computer Science and Control (INRIA) and ICube laboratory, where he heads the ICPS (Parallel and scientific computation) research team.

Continue reading...