Atmel CAVR-4 ユーザーズマニュアル

ページ / 323
CAVR-4
Part 2. Compiler reference
The preprocessor
235
For detailed information about the calling conventions, see Calling convention, page 99.
Preprocessor extensions
The following section gives reference information about the extensions that are 
available in addition to the pragma directives and ISO/ANSI directives.
#warning message
Use this preprocessor directive to produce messages. Typically this is useful for 
assertions and other trace utilities, similar to the way the ISO/ANSI standard 
#error
 
directive is used. The syntax is:
#warning message
where 
message
 can be any string.
_ _VA_ARGS_ _
Variadic macros are the preprocessor macro equivalents of 
printf
 style functions.
Syntax
#define P(...)       _ _VA_ARGS_ _
#define P(x,y,...)   x + y + _ _VA_ARGS_ _
Here, 
_ _VA_ARGS_ _
 will contain all variadic arguments concatenated, including the 
separating commas.
Example
#if DEBUG
  #define DEBUG_TRACE(...) printf(S,_ _VA_ARGS_ _)
#else
  #define DEBUG_TRACE(...)
#endif
...
DEBUG_TRACE("The value is:%d\n",value);
will result in:
printf("The value is:%d\n",value);