C pre-processor macro expansion

前端 未结 1 1939
时光说笑
时光说笑 2021-01-05 03:25

I\'m trying to do (what I would have thought) was a simple macro expansion

#define CLEAR_DIGIT(a,b)    iconMap[a] &= ~(b)
#define R1 4, 16
CLEAR_DIGIT(R1         


        
相关标签:
1条回答
  • 2021-01-05 04:07

    You could use a helper macro. See also double-stringize problem

    #define CLEAR_DIGIT_HELPER(a,b) iconMap[a] &= ~(b)
    #define CLEAR_DIGIT(x) CLEAR_DIGIT_HELPER(x)
    #define R1 4, 16
    CLEAR_DIGIT(R1);
    
    0 讨论(0)
提交回复
热议问题