Is there a way to block the extension of a macro processor? I have an existing C header file that uses #define to define a set of integers, and I would like to copy it to a C ++ enum that has the same value names. For example (using C ++ 11):
enum MyEnum { VALUE,
The problem, of course, is that MyEnum::VALUE translates to MyEnum::0 , which causes a syntax error. The best solution is to replace macros with enumerations, but, unfortunately, this is not an option in my situation.
I tried using concatenation but that did not help (the compiler gave the same error).
Is there another solution that allows me to have the same name for a macro and for an enumeration value?
source share