Saturday, December 24, 2011

ISO releases new standard for the C language

As a Christmas Present to all, the International Organization for Standardization (ISO) has published the new specifications for the C programming language, ISO/IEC 9899:2011. All for the whopping low price of $300!

Drafts of what has become known as C1X have been available for free up to now. This is the last free draft that I know of:

So far the critiques of the new standard have been unkind, and I'll add my own on the new Static Assertions; also known as Compile Time Assertions. The C1X standard gives Static Assertions, called _Static_assert:

6.7.10 Static assertions


1: static_assert-declaration: _Static_assert ( constant-expression , string-literal ) ;

While the C++0X standard, released as ISO/IEC 14882:2011, calls the same function static_assert (all lower case, no leading underscore):

"In a static_assert-declaration the constant-expression shall be a constant expression (5.19) that can be contextually converted to bool (Clause 4). If the value of the expression when so converted is true, the declaration has no effect. Otherwise, the program is ill-formed, and the resulting diagnostic message (1.4) shall include the text of the string-literal, except that characters not in the basic source character set (2.3) are not required to appear in the diagnostic message.
[ Example: static_assert(sizeof(long) >= 8, "64-bit code generation required for this library."); -end example ]"

Is it really to much to ask for these two groups to actually communicate with each other?

No comments:

Post a Comment