【发布时间】:2014-12-30 12:16:07
【问题描述】:
正如标题所暗示的,我的问题是预处理器指令#if 和#endif 是否像作用域一样?考虑这个例子:
#define foo 1
#define bar 1
#if foo
#undef bar
#endif //foo
// Is 'bar' defined or undefined here?
【问题讨论】:
-
如果您的意思是定义的生命周期范围,那么不,它不是一个范围。 bar 将是未定义的。
-
您想如何检查:
if foo,但没有相应的值? -
请重新打开。这是一个不同的问题,而不是所引用问题的重复。
标签: c scope c-preprocessor preprocessor-directive