Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The tables below list these macros and which version of the C Standard they were introduced. The following macros are required in C11.:

Macro nameC90C99C11

__STDC__

__STDC_HOSTED__

 

__STDC_VERSION__1

 

__DATE__

__FILE__

__LINE__

__TIME__

...

 The following are optional environment macros in C11.:

Macro nameC90C99C11

__STDC_ISO_10646__

 

__STDC_MB_MIGHT_NEQ_WC__

 

__STDC_UTF_16__

 

 

__STDC_UTF_32__

 

 

...

 The following are optional feature macros in C11.:

Macro nameC90C99C11

__STDC_ANALYZABLE__

 

 

__STDC_IEC_559__

 

__STDC_IEC_559_COMPLEX__

 

__STDC_LIB_EXT1__ 

 

 

__STDC_NO_ATOMICS__

 

 

__STDC_NO_COMPLEX__

 

 

__STDC_NO_THREADS__

 

 

__STDC_NO_VLA__ 

 

 

...

 The following is optional in C11 and is defined by the user:

Macro nameC90C99C11
__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
bgColor#ccccff
langc
#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)

...