#ifdef inside #define

前端 未结 6 1883
情书的邮戳
情书的邮戳 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:25

    You cannot. But you can swap #ifdef and #define:

    #ifdef COVERAGE_TOOL
    #   define COV_ON(x) _Pragma (COVERAGE #x)
    #else
    #   define COV_ON(x)
    #endif
    

提交回复
热议问题