HP aC++ Release Notes Version A.03.95 (5900-1789; September 2011)

HP aC++ Release Notes
New Features in Version A.03.25
Chapter 1 63
a ax;
ax.sub (0);
return 0;
}
Output from the example would be:
__FUNCTION__ = sub
__PRETTY_FUNCTION__ = int a::sub (int)
NOTE These names are not macros. They are predefined string variables. For example, #ifdef
__FUNCTION__ has no special meaning inside a function, since the preprocessor does not
recognize __FUNCTION__. Also note, the names __FUNCTION__,
__PRETTY_FUNCTION__, and __func__ are reserved for use by the compiler. If any
other identifier is explicitly declared using any of these names, the behavior is undefined.
Macros Having a Variable Number of Arguments
A macro can be defined to accept a variable number of arguments, much as you would define a function.
This provides compatibility with the C99 standard and GNU/gcc style coding. If you have coded your
macros in GNU/gcc style, you can expect GNU/gcc style behavior. If you have coded your macros to C99
standards, you can expect C99 style behavior.
For C99 style coding:
If there is an ellipsis (...) in the identifier-list in the macro definition, then the trailing arguments,
including any separating comma preprocessing tokens, are merged to form a single item: the variable
arguments. The number of arguments so combined is such that, following merger, the number of arguments
is one more than the number of parameters in the macro definition (excluding the ...).
Any __VA_ARGS__ identifier occurring in the replacement list is treated as if it were a parameter. The
variable arguments form the preprocessing tokens used to replace it. Following are examples:
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define showlist(...) puts(#__VA_ARGS__)
#define report(test, ...)((test)?puts(#test):printf(VA_ARGS__))
debug(“Flag”);
debug(“X = %d\n”, x);
showlist(The first, second, and third items.);
report(x>y, “X is %d but y is %d”, x, y);
Will be expanded to: