Preprocessor macro and BOOL weirdness

后端 未结 2 1771

Code below yields the output \"yes defined\", \"no defined\" and \"yes\". Why?

#define FOOBAR NO
- (BOOL)application:(UIApplication *)application didFinishLa         


        
2条回答
  •  萌比男神i
    2021-01-13 16:36

    All identifieres that the preprocessor doesn't know of are replaced with 0 for evaluation in #if directives. If you don't have defined YES and NO both are 0 (and thus equal).

提交回复
热议问题