ISO Standard Predefined Macro Names

Both C and C++ provide the following predefined macro names as specified in the ISO C language standard. Except for __FILE__ and __LINE__, the value of the predefined macros remains constant throughout the translation unit.

Macro Name
Description

 __DATE__ 
A character string literal containing the date when the source file was compiled.

The value of __DATE__ changes as the compiler processes any include files that are part of your source program. The date is in the form:

      "Mmm dd yyyy"

where:

Mmm
Represents the month in an abbreviated form (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, or Dec).
dd
Represents the day. If the day is less than 10, the first d is a blank character.
yyyy
Represents the year.

 __FILE__ 
A character string literal containing the name of the source file.

The value of __FILE__ changes as the compiler processes include files that are part of your source program. It can be set with the #line directive.

 __LINE__ 
An integer representing the current source line number.

The value of __LINE__ changes during compilation as the compiler processes subsequent lines of your source program. It can be set with the #line directive.

 __STDC__ 
For C, the integer 1 (one) indicates that the C compiler supports the ISO standard. (When a macro is undefined, it behaves as if it had the integer value 0 when used in a #if statement.)

For C++, this macro is predefined to have the value 0 (zero). This indicates that the C++ language is not a proper superset of C, and that the compiler does not conform to ISO C.

 __STDC_HOSTED__ 
The value of this C99 macro is 1, indicating that the C compiler is a hosted implementation.

 __STDC_VERSION__ 
The integer constant of type long int: 199409L for the C89 language level, 199901L for C99.

 __TIME__ 
A character string literal containing the time when the source file was compiled.

The value of __TIME__ changes as the compiler processes any include files that are part of your source program. The time is in the form:

      "hh:mm:ss"

where:

hh
Represents the hour.
mm
Represents the minutes.
ss
Represents the seconds.

 __cplusplus 
For C++ programs, this macro expands to the long integer literal 199711L, indicating that the compiler is a C++ compiler. For C programs, this macro is not defined. Note that this macro name has no trailing underscores.

In addition to the predefined macros required by the language standard, the predefined macro __IBMC__ indicates the level of the C compiler, and the predefined macro __IBMCPP__ indicates that of the C++ compiler.

The value is an integer of the form VRM, where

V
Represents the version number.
R
Represents the release number.
M
Represents the modification number.

Related References

IBM Copyright 2003