3.3.1. Variadic macros

In C90 and C++ you can declare a macro to accept a variable number of arguments.

The syntax for declaring a variadic macro in C90 and C++ follows the C99 syntax for declaring a variadic macro, unless the option --gnu is selected. If the option --gnu is specified, the syntax follows GNU syntax for variadic macros.


#define debug(format, ...) fprintf (stderr, format, __VA_ARGS__)

void variadic_macros(void)
    debug ("a test string is printed out along with %x %x %x\n", 12, 14, 20);

See also

Copyright © 2007, 2010 ARM Limited. All rights reserved.ARM DUI 0348A