4
考虑下面的代码片段:使用'defined'和'ifdef'?
#ifdef AAA && (defined BBB)
...
#endif
GCC-4.5.2在这条线抱怨:在#ifdef指令结束
额外的令牌。
它是非法的ifdef
和defined
结合?
谢谢!
考虑下面的代码片段:使用'defined'和'ifdef'?
#ifdef AAA && (defined BBB)
...
#endif
GCC-4.5.2在这条线抱怨:在#ifdef指令结束
额外的令牌。
它是非法的ifdef
和defined
结合?
谢谢!
#ifdef
需要一个标识符,相当于#if defined(identifier)
。
你需要,如果你有一个更复杂的表达式使用#if
指令:
#if (defined AAA) && (defined BBB) // true if AAA and BBB are both defined
#if AAA && (defined BBB) // true if AAA is true and BBB is defined
#ifdef
只能在一个令牌工作。 如果你想使用一个以上然后写
#if defined(AAA) && defined(BBB)
什么定义? –