【发布时间】:2013-12-28 07:05:21
【问题描述】:
想象一下,我有一个调试源文件, 是这样的:
#if _OWN_DEBUG_LEVEL != 0
void DebugLogMsg (DebugStruct_t *DebugStruct, size_t sizeID, char const *szFormat, ...);
#else
#define DebugLogMsg(_Expression1, _Expression2, _Expression3) ((void)0)
#endif
在这种情况下,我并不真正关心函数的附加参数,但是这种情况呢?
#if _OWN_DEBUG_LEVEL > 0
#undef DebugLogMsg1
#define DebugLogMsg1(_Expression1, _Expression2, _Expression3) \
DebugLogMsg(_Expression1, _Expression2, _Expression3)
#endif
在这种情况下,我不太确定......当我这样调用宏时:
DebugLogMsg1(pointer, var, pointer, 1, 2, 3);
_Expression3 是否会被视为pointer, 1, 2, 3,或者确切的行为是什么?
【问题讨论】:
标签: c macros c-preprocessor c99