C/C++ Programmer's Guide (G06.25+)
Preprocessor Directives and Macros
HP C/C++ Programmer’s Guide for NonStop Servers—429301-002
12-12
Predefined Symbols
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.
Variadic Macros
Two variants of variadic macro definitions can be invoked in native C with a variable 
number of arguments. To use these extensions, you must compile with extensions 
enabled.
•
One variant of variadic macro is the C9X form, described in section 6.8.3 of the 
Working Draft, 1997-11-21, WG14/N794 J11/97-158 of the Proposed ISO C 
Standard.
For example:
#define D(fmt, ...) printf(fmt, __VA_ARGS__)
/* The "..." matches an arbitrary positive number of macro
arguments that can be referred to by __VA_ARGS__
(includes the separating commas) */
D("%c%s\n" , ’E’, "DG");
/* Expands to "printf("%c%s\n", ’E’, "DG");" */










