#ifdef and #ifndef are special abbreviations for #if defined(...) and #if !defined(...). However, they can only be used for a single macro and do not allow for logical operations. So, if checking for multiple macros, use #if with the defined() operator instead. Being a regular operatior, this can be combined with logical operations, as the for !defined() already does.
0
Some programmer dude
On
Use the #if preprocessor directive instead:
#if !defined(MACRO1) || !defined(MACRO2)
0
Eugene Sh.
On
You can use logical operators in preprocessor directives, but in order to check something defined, use the defined directive:
#ifdef
and#ifndef
are special abbreviations for#if defined(...)
and#if !defined(...)
. However, they can only be used for a single macro and do not allow for logical operations. So, if checking for multiple macros, use#if
with thedefined()
operator instead. Being a regular operatior, this can be combined with logical operations, as the for!defined()
already does.