In many of the C and C++ files I have seen macros like this:
#ifdef X
#undef X // no statements in between
#endif
I feel that, it's adequate to simply write:
#undef X
If the macro X
wasn't defined, then the #undef
should have no effect.
Is it ok to put standalone #undef
, if I want to only undefine a macro ? Does that make the coding practice bad in anyway ?