C macro: #if check for equality

前端 未结 3 1190
礼貌的吻别
礼貌的吻别 2020-12-16 10:03

Is there a way to do check for numerical equality in macros?

I want to do something like

#define choice 3

#if choice == 3
  ....
#endif

#if choice          


        
3条回答
  •  误落风尘
    2020-12-16 10:45

    Indeed that should work. See http://gcc.gnu.org/onlinedocs/cpp/If.html#If

    That reference is accurate, but written in "standards format":  abstractly without examples.

提交回复
热议问题