Possible duplicate:
C / C ++: how to make a variable macro (variable number of arguments)
Just wondering if this is possible at all. Therefore, instead of how IM processes logging and messages with several parameters, they need to have several different macros for each case, for example:
#define MSG( msg )
#define MSG1( fmt, arg1 )
#define MSG2( fmt, arg1, arg2 )
#define MSG3( fmt, arg1, arg2, arg3 )
#define MSG4( fmt, arg1, arg2, arg3, arg4 )
#define MSG5( fmt, arg1, arg2, arg3, arg4, arg5 )
#define MSG6( fmt, arg1, arg2, arg3, arg4, arg5, arg6)
Is there a way to define only one macro that can take any number of arguments?
thank
source
share