C/C++ Programmer's Guide (G06.27+, H06.08+, J06.03+)

Table 26 Predefined Macros
What It Expands ToMacro
A string literal representing the date of compilation. This string has the form Mmm dd
yyyy, where the first character of the day (dd) is a blank if the day is less than 10.
__DATE__
A string literal representing the name of the current source file. The file name is qualified
up to the volume (or device) name if the file is on the same system as the compiler;
otherwise, the file name is qualified up to the system name.
__FILE__
A string representing the name of the current function, or an empty string if it appears
outside of a function. This macro cannot be redefined.
__FUNCTION__
A long value representing the current line number in the current source file. If the current
source file is an EDIT file, this value is equal to the EDIT line number multiplied by 1000.
__LINE__
For any other type of source file, this value is equal to the ordinal value of the line multiplied
by 1000.
A long value signifying that the compiler is to comply with the ISO/ANSI C standard. If
the value is 1, the compiler complies with the standard.
__STDC__
A string literal representing the time of compilation. This string has the form hh:mm:ss,
where the hour (hh) ranges from 0 to 23. The time zone is that of the system on which
the compilation takes place.
__TIME__
None of these predefined macros can be removed using #undef.
This example demonstrates the use of the __FUNCTION__ macro:
#include <stdio.h>
char ch[] = __FUNCTION__;
void foo (void) {
printf ("Entering function %s\n", __FUNCTION__);
printf ("ch[] was in function \"%s\"\n", ch);
};
int main (void) {
foo ();
}
The output from the preceding code is:
Entering function foo
ch[] was in function ""
Predefined Symbols
The compiler provides three predefined preprocessor symbols: __TANDEM, __INT32, and __XMEM.
You can use the __TANDEM symbol to increase the portability of your programs. Enclose
system-dependent source text in an if section that uses #ifdef or #ifndef to test for the existence
of the __TANDEM symbol.
The predefined preprocessor symbol __INT32 is defined by the TNS C compiler and CFront when
the WIDE pragma is present. The predefined preprocessor symbol __XMEM is defined by the TNS
C compiler and Cfront when the XMEM pragma is present. The native compilers always define the
preprocessor symbols __INT32 and __XMEM.
The __INT32 and __XMEM preprocessor symbols affect the visibility of declarations in header
files.
Predefined Symbols 161