ILE C/C++ Language Reference
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 remain the
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. If you set the language level to anything other than
ANSI, this macro is undefined. (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_VERSION__
- The integer constant of type long int: 199409L for
the C89 language level.
- __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.
Related References
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.