No, this is not possible. #ifdef
and #if
are part of preprocessor, which completes its run before the portion of the compiler that "understands" enum
s.
#ifdef
works only with preprocessor constants (i.e. things defined with #define
, or passed to the compiler on the command line, say, with a -DMYVAR=123
option).
#if
works with integer and character constants, and preprocessor constants. All identifiers which are not preprocessor constants are considered undefined, and interpreted as if they were zeros when evaluating #if
conditions. This includes enum
constants.