How to test if preprocessor symbol is #define'd but has no value?

前端 未结 9 1372
渐次进展
渐次进展 2020-11-30 06:08

Using C++ preprocessor directives, is it possible to test if a preprocessor symbol has been defined but has no value? Something like that:

#define MYVARIABLE         


        
9条回答
  •  一生所求
    2020-11-30 07:11

    I don't think that this can be done. That being said, I don't see a need for it. When you make a preprocessor #define symbol, you should establish a convention that either you define it as 1 or 0 for use in #if, or you leave it blank.

提交回复
热议问题