Issue
For some reason I need to temporarily disable some macros in a header file and the #undef MACRONAME
will make the code compile but it will undef the existing macro.
Is there a way of just disabling it?
I should mention that you do not really know the values of the macros and that I'm looking for a cross compiler solution (should work at least in GCC and MSVC).
Solution
In MSVC you could use push_macro
pragma, GCC supports it for compatibility with Microsoft Windows compilers.
#pragma push_macro("MACRONAME")
#undef MACRONAME
// some actions
#pragma pop_macro("MACRONAME")
Answered By - Kirill V. Lyadvinsky