#ifdef inside #define

前端 未结 6 1888
情书的邮戳
情书的邮戳 2020-11-29 02:31

I am trying to write something like this:

#define COV_ON(x) \\
                #ifdef COVERAGE_TOOL \\
                    _Pragma (COVERAGE #x)
                     


        
6条回答
  •  天命终不由人
    2020-11-29 03:17

    As you mentioned it is not possible to have an #ifdef in a #define. What you should do instead is reverse the order:

    #ifdef COVERAGE_TOOL \
      #define COV_ON(x) \
        etc.
    #endif
    

提交回复
热议问题