C1X
Encyclopedia
C1X is the unofficial name of the planned new standard
for the C programming language. It is intended to replace the existing C standard, informally known as C99
. This new version mainly standardizes features that have already been supported by common contemporary compilers, and includes a detailed memory model to better support multiple threads
of execution. Due to delayed availability of conforming C99 implementations, C1X may make more features optional, to make it easier to comply with the core language standard.
The most recent working draft, N1570, was published in April 2011. The new standard passed its final draft review on October 10, 2011, with no comments requiring resolution from participating national bodies; therefore, official ratification is likely with no further technical changes.
GCC
version 4.6 has added initial support for some features from the C1X draft.
Open standard
An open standard is a standard that is publicly available and has various rights to use associated with it, and may also have various properties of how it was designed . There is no single definition and interpretations vary with usage....
for the C programming language. It is intended to replace the existing C standard, informally known as C99
C99
C99 is a modern dialect of the C programming language. It extends the previous version with new linguistic and library features, and helps implementations make better use of available computer hardware and compiler technology.-History:...
. This new version mainly standardizes features that have already been supported by common contemporary compilers, and includes a detailed memory model to better support multiple threads
Thread (computer science)
In computer science, a thread of execution is the smallest unit of processing that can be scheduled by an operating system. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process...
of execution. Due to delayed availability of conforming C99 implementations, C1X may make more features optional, to make it easier to comply with the core language standard.
The most recent working draft, N1570, was published in April 2011. The new standard passed its final draft review on October 10, 2011, with no comments requiring resolution from participating national bodies; therefore, official ratification is likely with no further technical changes.
GCC
GNU Compiler Collection
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...
version 4.6 has added initial support for some features from the C1X draft.
Changes from C99
The October 2010 draft includes several changes to the C99 language and library specifications, such as:- AlignmentData structure alignmentData structure alignment is the way data is arranged and accessed in computer memory. It consists of two separate but related issues: data alignment and data structure padding. When a modern computer reads from or writes to a memory address, it will do this in word sized chunks...
specification (_Alignas
specifier,alignof
operator,aligned_alloc
function,
header file) - The
_Noreturn
function specifier - Type-generic expressions using the
_Generic
keyword. For example, the following macrocbrt(x)
translates tocbrtl(x)
,cbrt(x)
orcbrtf(x)
depending on the type ofx
:
- MultithreadingThread (computer science)In computer science, a thread of execution is the smallest unit of processing that can be scheduled by an operating system. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process...
support (_Thread_local
storage-class specifier,
header including thread creation/management functions, mutexMutual exclusionMutual exclusion algorithms are used in concurrent programming to avoid the simultaneous use of a common resource, such as a global variable, by pieces of computer code called critical sections. A critical section is a piece of code in which a process or thread accesses a common resource...
, condition variable and thread-specific storageThread-local storageThread-local storage is a computer programming method that uses static or global memory local to a thread.This is sometimes needed because normally all threads in a process share the same address space, which is sometimes undesirable...
functionality, as well as the_Atomic
type qualifier and
for uninterruptible object accessLinearizabilityIn concurrent programming, an operation is atomic, linearizable, indivisible or uninterruptible if it appears to the rest of the system to occur instantaneously. Atomicity is a guarantee of isolation from concurrent processes...
). - Improved UnicodeUnicodeUnicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...
support based on the C Unicode Technical Report ISO/IEC TR 19769:2004 (char16_t
andchar32_t
types for storing UTF-16/UTF-32 encoded data, including conversion functions in
and the correspondingu
andU
string literal prefixes, as well as theu8
prefix for UTF-8UTF-8UTF-8 is a multibyte character encoding for Unicode. Like UTF-16 and UTF-32, UTF-8 can represent every character in the Unicode character set. Unlike them, it is backward-compatible with ASCII and avoids the complications of endianness and byte order marks...
encoded literals). - Removal of the
gets
function, deprecated in the current C language standard revision, ISO/IEC 9899:1999/Cor.3:2007(E), in favor of a new safe alternative,gets s
. - Bounds-checkingBounds checkingIn computer programming, bounds checking is any method of detecting whether a variable is within some bounds before its use. It is particularly relevant to a variable used as an index into an array to ensure its value lies within the bounds of the array...
interfaces (Annex K). - Analyzability features (Annex L).
- More macros for querying the characteristics of floating point types, concerning subnormal floating point numbersDenormal numberIn computer science, denormal numbers or denormalized numbers fill the underflow gap around zero in floating point arithmetic: any non-zero number which is smaller than the smallest normal number is 'sub-normal'.For example, if the smallest positive 'normal' number is 1×β−n In computer...
and the number of decimal digits the type is able to store. - Anonymous structures and unions, useful when unions and structures are nested, e.g. in
struct T { int tag; union { float x; int n; }; };
. - Static assertions, which are evaluated during translation at a later phase than
#if
and#error
, when types are understood by the translator. - An exclusive create-and-open mode (
"…x"
) for fopen. This behaves likeO_CREAT|O_EXCL
in POSIXOpen (system call)For most file systems, a program initializes access to a file in a filesystem using the open system call. This allocates resources associated to the file , and returns a handle that the process will use to refer to that file...
, which is commonly used for lock files. - The
quick exit
function as a third way to terminate a program, intended to do at least minimal deinitializition if termination withexit
fails.Exit (operating system)On many computer operating systems, a computer process terminates its execution by making an exit system call. More generally, an exit in a multithreading environment means that a thread of execution has stopped running. The operating system reclaims resources that were used by the process... - Macros for the construction of complex valuesComplex numberA complex number is a number consisting of a real part and an imaginary part. Complex numbers extend the idea of the one-dimensional number line to the two-dimensional complex plane by using the number line for the real part and adding a vertical axis to plot the imaginary part...
(partly becausereal + imaginary*I
might not yield the expected value ifimaginary
is infinite or NaNNaNIn computing, NaN is a value of the numeric data type representing an undefined or unrepresentable value, especially in floating-point calculations...
).
Optional features
The new revision will allow implementations not to support certain parts of the standard — including some that had been mandatory to support in the 1999 revision. Programs can use predefined macros to determine whether an implementation supports a certain feature or not.Feature | Feature test macro | Availability in C99 |
---|---|---|
Analyzability (Annex L) | __STDC_ANALYZABLE__ |
|
IEC 60559 floating-point arithmetic (Annex F) | __STDC_IEC_559__ |
|
IEC 60559 compatible complex arithmetic (Annex G) | __STDC_IEC_559_COMPLEX__ |
|
Bounds-checking interfaces (Annex K) | __STDC_LIB_EXT1__ |
|
Complex types ( ) |
__STDC_NO_COMPLEX__ |
|
Multithreading ( ) |
__STDC_NO_THREADS__ |
|
Atomic primitives and types ( and the _Atomic type qualifier) |
__STDC_NO_ATOMICS__ |
|
Variable length arrays | __STDC_NO_VLA__ |
External links
- The C1X Charter
- N1570, the current draft of C1X , dated
- ISO C Working Group's official website