在 C++ 中,是这样的:
#ifdef A && B
同:
#if defined(A) && defined(B)
?
我以为不是,但我无法通过我的编译器 (VS2005) 找到差异。
最佳答案
它们不一样。第一个不起作用(我在 gcc 4.4.1 中测试过)。错误信息是:
test.cc:1:15: warning: extra tokens at end of #ifdef directive
如果要检查是否定义了多个事物,请使用第二个。
关于c++ - ifdef : is "#ifdef A && B" the same as "#if defined(A) && defined(B)"? 中的 bool 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1312132/