...
Static assertion is a new facility in the C standard [ISO/IEC 9899:2011] and the C++ 0X draft standard [Becker 2008]Sandard. It takes the form
Code Block |
---|
static_assert(constant-expression, string-literal); |
C11, Section Section 6.7.10 , statesof the C Standard [ISO/IEC 9899:2011] states:
The constant expression shall be an integer constant expression. If the value of the constant expression compares unequal to 0, the declaration has no effect. Otherwise, the constraint is violated and the implementation shall produce a diagnostic message that includes the text of the string literal, except that characters not in the basic source character set are not required to appear in the message.
...
ISO/IEC 9899:2011 Section 6.10.1, "Conditional inclusion," and Section 6.10.3.3, "The ##
operator," and Section 7.2.1, "Program diagnostics"
...
Sources
[Becker 2008]
[Eckel 2007]
[Jones 2010]
[Klarer 2004]
[Saks 2005]
[Saks 2008]
...