Predefined macros

suggest change

Every conforming implementation provides macros that describe the translation and implementation environment.

Source-location and translation macros

Common __STDC_VERSION__ values include:

Revision Value
C95 199409L
C99 199901L
C11 201112L
C17 201710L
C23 202311L

C90 does not define __STDC_VERSION__. An implementation may also use a newer value for a later revision.

__func__ is a predefined identifier, not a macro. Inside each function, it behaves as though an array containing the function's unqualified name had been declared:

fprintf(stderr, "%s:%d: %s: invalid value\n",
        __FILE__, __LINE__, __func__);

Avoid embedding __DATE__ or __TIME__ when reproducible builds matter because their values can make otherwise identical builds differ.

Conditional feature macros

Depending on the language version and implementation, macros can describe optional facilities or environmental properties. Examples include:

Test a feature macro with #if defined(...) before reading its value unless the selected standard guarantees that the macro is defined. The available names and their meanings changed across C revisions, so consult the documentation for the language mode and implementation being targeted.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents