Top "Variadic-macros" questions

Variadic macros are a feature of the C-preprocessor that permit a variable number of arguments to a macro.

C++ preprocessor __VA_ARGS__ number of arguments

Simple question for which I could not find answer on the net. In variadic argument macros, how to find the …

c++ c c-preprocessor variadic-macros
Standard alternative to GCC's ##__VA_ARGS__ trick?

There is a well-known problem with empty args for variadic macros in C99. example: #define FOO(...) printf(__VA_ARGS__) #define …

c c99 c-preprocessor variadic-macros
What does __VA_ARGS__ in a macro mean?

/* Debugging */ #ifdef DEBUG_THRU_UART0 # define DEBUG(...) printString (__VA_ARGS__) #else void dummyFunc(void); # define DEBUG(...) dummyFunc() #endif I've seen …

c gcc variadic-macros variadic-functions
Variadic macros with zero arguments

I am working on a call macro, #define CALL(f,...) FN(f)->call((ref(new LinkedList()), __VA_ARGS__)) …

c++ gcc c-preprocessor variadic-macros
Are Variadic macros nonstandard?

For debugbuilds, I usually use Clang, as it formats warnings and errors better, and makes it a little easier to …

c++ c-preprocessor variadic-macros
MSVC doesn't expand __VA_ARGS__ correctly

Consider this code: #define F(x, ...) X = x and VA_ARGS = __VA_ARGS__ #define G(...) F(__VA_ARGS__) F(1, 2, 3) G(1, 2, 3) …

visual-c++ c-preprocessor variadic-macros
A better LOG() macro using template metaprogramming

A typical LOG() macro-based logging solution may look something like this: #define LOG(msg) \ std::cout << __FILE__ <&…

c++ logging c++11 variadic-templates variadic-macros
Variadic macro trick

What's the trick to create a variadic macro FOO(a1, a2, a3,..., an) such that it expands to FOOn(a1, …

c c-preprocessor variadic-macros
Can macros be overloaded by number of arguments?

How does this work? How can a C99/C++11 variadic macro be implemented to expand to different things on the …

c++ c overloading c-preprocessor variadic-macros
Can I define variadic C preprocessor macros with __VA_ARGS in the middle instead of the end?

GCC complains if I do this: #define M(obj,met, ..., contents) obj##_##met(const void * self, __VA_ARGS__) { \ contents \ } Giving …

c gcc c-preprocessor c99 variadic-macros