Conditional value for a #define
问题 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