C99 way, also supported by VC++ compiler.
#define FOO(fmt, ...) printf(fmt, ##__VA_ARGS__)
More Related Contents:
- Is it possible to iterate over arguments in variadic macros?
- Easy way to use variables of enum types as string in C?
- How do I check OS with a preprocessor directive?
- What are the applications of the ## preprocessor operator and gotchas to consider?
- Macro definition to determine big endian or little endian machine?
- Stringification of a macro value
- What is the meaning of lines starting with a hash sign and number like ‘# 1 “a.c”‘ in the gcc preprocessor output?
- Are typedef and #define the same in c?
- Standard alternative to GCC’s ##__VA_ARGS__ trick?
- What are the valid characters for macro names?
- Does the C preprocessor strip comments or expand macros first? [duplicate]
- What does ## mean for the C(C++) preprocessor?
- Are empty macro definitions allowed in C? How do they behave?
- Variadic macro trick
- How to use #if inside #define in the C preprocessor?
- #ifdef inside #define
- Spaces inserted by the C preprocessor
- Is there a good reason for always enclosing a define in parentheses in C?
- Detecting Endianness
- Macro to count number of arguments
- C preprocessor: expand macro in a #warning
- C Macros to create strings
- Macro and function with same name
- C circular dependency
- Is the sizeof(enum) == sizeof(int), always?
- What is a good reference documenting patterns of use of X-Macros in C (or possibly C++)?
- Should variable definition be in header files?
- How can I implement a dynamic dispatch table in C
- offsetof at compile time
- Using Parentheses in Define Preprocessor Statements