The C Standard defines a set of predefined macros (see subclause 6.10.8) to help the user determine if the implementation being used is a conforming implementation, and if so, to which version of the C Standard it conforms. These macros can also help the user to determine which of the standard features are implemented.
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 | |
---|---|---|---|---|
| ✓ | C99 ✓ | C11 ✓ | |
| C99 | ✓ | C11 ✓ | |
| (C94) C99 | ✓ | C11 ✓ | |
| ✓ | C99 ✓ | C11 ✓ | |
| ✓ | C99 ✓ | C11 ✓ | |
| ✓ | C99 ✓ | C11 ✓ | |
| ✓ | C99 ✓ | C11 | ✓ |
1) __STDC_VERSION__ was introduced by an Amendment to C90, this version of the C Standard is commonly call C94
The following are optional environment macros in C11.
Macro name | C90 | C99 | C11 |
---|---|---|---|
| C99 | ✓ | C11 ✓ |
| C99 | ✓ | C11 ✓ |
|
| C11 | ✓ |
|
| C11 | ✓ |
The following are optional feature macros in C11.
Macro name | C90 | C99 | C11 |
---|---|---|---|
|
| C11 | ✓ |
| C99 | ✓ | C11 ✓ |
| C99 | ✓ | C11 ✓ |
|
| C11 | ✓ |
|
| C11 | ✓ |
|
| C11 | ✓ |
|
| C11 | ✓ |
|
| C11 | ✓ |
The following is optional in C11 and is defined by the user:
Macro name | C90 | C99 | C11 |
---|---|---|---|
__STDC_WANT_LIB_EXT1__ | C11 | ✓ |
Noncompliant Code Example (Checking value of predefined macro)
...