A predefined macro in the C language. It expands to the date of the latest revision of the C standard the compiler supports. The macro expands to a long int with the value YYYYMM, where YYYY is year and MM is the month (1 = January, 2 = February, etc.). In case its not clear, the macro has two leading underscores, one in the middle, and two at the end.

Programmers can use this conditionally compile in code that uses features that are only supported in later revisions of the C standard. A program should generally test if this value is equal to or greater than the first revision of the C standard that supports the feature.

Some common values for this are listed below. Note the uppercase "L" is required to specify a long int constant.

A contrived example:
#if __STDC_VERSION__ >= 199901L
#include <stdbool.h>
#else
typedef int bool;
#define true 1
#define false 0
#endif

Log in or register to write something here or to contact authors.