M
myheartinamerica
Hello,
I was working on a piece of code where a vendor's #define was causing
compiler warnings, which led me to try and do the following:
#if defined(VAR1)
#define VAR1_SAVE VAR1
#undef VAR1
#endif
#define VAR1 1
#define VAR2 (10 - VAR1)
#undef VAR1
#if defined(VAR1_SAVE)
#define VAR1 VAR1_SAVE
#undef VAR1_SAVE
#endif
Even if this is ridiculous, I'm unsure as to why it didn't work. Any
insights? I needed VAR2 to be #defined in terms of VAR1, but I needed
it to be my own locally #define'd VAR1.
I was working on a piece of code where a vendor's #define was causing
compiler warnings, which led me to try and do the following:
#if defined(VAR1)
#define VAR1_SAVE VAR1
#undef VAR1
#endif
#define VAR1 1
#define VAR2 (10 - VAR1)
#undef VAR1
#if defined(VAR1_SAVE)
#define VAR1 VAR1_SAVE
#undef VAR1_SAVE
#endif
Even if this is ridiculous, I'm unsure as to why it didn't work. Any
insights? I needed VAR2 to be #defined in terms of VAR1, but I needed
it to be my own locally #define'd VAR1.