Skip to main content

#if defined()

#if defined(SOMETHING) offers more flexibility than #ifdef SOMETHING. For example you can use negation, and and or : #if defined(SOMETHING) && !defined(SOMETHING_ELSE)

You can also it with #elif :

#if defined(MACRO1)
// ...
#elif defined(MACRO2)
// ...
#elif defined(MACRO3)
// ...
#else
// ...
#endif