...
The tables below list these macros and which version of the C Standard they were introduced. The following macros are required in C11.:
Macro name | C90 | C99 | C11 |
---|---|---|---|
| ✓ | ✓ | ✓ |
|
| ✓ | ✓ |
|
| ✓ | ✓ |
| ✓ | ✓ | ✓ |
| ✓ | ✓ | ✓ |
| ✓ | ✓ | ✓ |
| ✓ | ✓ | ✓ |
...
The following are optional environment macros in C11.:
Macro name | C90 | C99 | C11 |
---|---|---|---|
|
| ✓ | ✓ |
|
| ✓ | ✓ |
|
|
| ✓ |
|
|
| ✓ |
...
The following are optional feature macros in C11.:
Macro name | C90 | C99 | C11 |
---|---|---|---|
|
|
| ✓ |
|
| ✓ | ✓ |
|
| ✓ | ✓ |
|
|
| ✓ |
|
|
| ✓ |
|
|
| ✓ |
|
|
| ✓ |
|
|
| ✓ |
...
The following is optional in C11 and is defined by the user:
Macro name | C90 | C99 | C11 |
---|---|---|---|
__STDC_WANT_LIB_EXT1__ | ✓ |
Noncompliant Code Example (Checking value of predefined macro)
The value a C Standard predefined macro macros should never be tested for a value before the macro is tested to make sure it is definedtested for definition, as shown in this noncompliant code example:
...
In this compliant solution, the definition of the predefined macro __STDC__
is tested before the value of the macro is tested:
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stdio.h> int main(void) { #if defined(__STDC__) #if (__STDC__ == 1) printf("Implementation is ISO-conforming.\n"); #else printf("Implementation is not ISO-conforming.\n"); #endif #else /* !defined(__STDC__) */ printf("__STDC__ is not defined.\n"); #endif /* ... */ return 0; } |
...
Compliant Solution (Test for Optional feature)
...