Conditional value for a #define

风格不统一 提交于 2019-12-11 23:19:57

问题


I want to define a macro kDependentMacro to be 38 if the macro kIndependentMacro is defined and 40 otherwise. What is the simplest way to do that?


回答1:


#ifdef kIndependentMacro
#  define kDependentMacro 38
#else
#  define kDependentMacro 40
#endif


来源:https://stackoverflow.com/questions/3041300/conditional-value-for-a-define

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!