How can I guarantee one #define is larger than another?

  • A+
Category:Languages
#define MY_CONST 20 #define OTHER_CONST 10 

My code only makes sense if MY_CONST > OTHER_CONST. How can I guarantee this with the preprocessor? Is there any command like this?

#assert MY_CONST < OTHER_CONST 

 


Is there any command like this?

#assert MY_CONST < OTHER_CONST

#if OTHER_CONST >= MY_CONST #error "Error, OTHER_CONST >= MY_CONST" #endif 

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: