可能是重复问题:
C/C++:如何制作可变参数宏(变量数量)
我在想这是否有可能。因此,不是使用多个参数处理日志和消息的方式,而是需要为每种情况编写许多不同的宏,例如:
#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)
有没有一种定义只能接受任意数量参数的宏的方法?
谢谢