Is it possible to get a value of an enum member at compile time?
In fact, I want to be able to do something like this:
enum {
FOO_FIRST = -1,
FOO_A,
FOO_B,
FOO_C,
FOO_LAST
};
#if FOO_LAST > 10
//...
#else
//..
#endif
I know that the cpp
don't know about variables, bad syntax, etc; only things that start with a #
(right)? but members of an enum has fixed-size and cannot be changed just like 10 (constant integer) value and the compiler know its size and values. so, Is there no any possibility to do such comparison (as I did above)? Could I use gcc-extensions?
I don't wish to rewrite all my enumerations by using #define
s and don't take my time doing some macros change.