Preprocessor equality test, is this standard?

后端 未结 5 1905
死守一世寂寞
死守一世寂寞 2021-02-05 11:27

I had envisaged one of these in the project preferences

  • TESTING = HOST
  • TESTING = TARGET
5条回答
  •  清酒与你
    2021-02-05 11:56

    #if TESTING==HOST
    

    If TESTING is not defined, then

    it is equivalent to:

    #if 0==HOST
    

    From the C Standard:

    (C99, 6.10.1p4) "After all replacements due to macro expansion and the defined unary operator have been performed, all remaining identifiers (including those lexically identical to keywords) are replaced with the pp-number 0""

提交回复
热议问题