Predefined preprocessor variables
Syntax:
__LINE__
__FILE__
__DATE__
__TIME__
__cplusplus
__STDC__
The following variables can vary by compiler, but generally work:
- The
__LINE__and__FILE__variables represent the current line and current file being processed. - The
__DATE__variable contains the current date, in the form month/day/year. This is the date that the file was compiled, not necessarily the current date. - The
__TIME__variable represents the current time, in the form hour:minute:second. This is the time that the file was compiled, not necessarily the current time. - The
__cplusplusvariable is only defined when compiling a C++ program. In some older compilers, this is also calledc_plusplus. - The
__STDC__variable is defined when compiling a C program, and may also be defined when compiling C++.
GCC-specific variables
The following are GCC-specific variables. While they are not specifically preprocessor macros they are magic and can be used the same way:
__func__contains the bare name of the function__FUNCTION__is another name for__func__- The
__PRETTY_FUNCTION__contains the type signature of the function as well as its bare name.