In C, is it possible to combine each of the variable arguments in a variable macro?
Example:
MY_MACRO(A, B, C) will yield HDR_A, HDR_B, HDR_C
MY_MACRO(X, Y) will yield HDR_X, HDR_Y
The normal operator ##has special meaning for variable macros (excluding the comma for an empty argument list). Concatenation in use __VA_ARGS__is performed only with the first token.
Example:
#define MY_MACRO(...) HDR_ ## __VA_AGRS__
MY_MACRO(X, Y) yields HDR_X, Y
Suggestions?
source
share