Undefining and Redefining Macros
3.8 Undefining and Redefining Macros
If a macro ceases to be useful, it may be undefined with the ‘#undef
’ directive. ‘#undef
’ takes a single argument, the name of the macro to undefine. You use the bare macro name, even if the macro is function-like. It is an error if anything appears on the line after the macro name. ‘#undef
’ has no effect if the name is not a macro.
#define FOO 4 x = FOO; ==> x = 4; #undef FOO x = FOO; ==> x = FOO;
Once a macro has been undefined, that identifier may be redefined as a macro by a subsequent ‘#define
’ directive. The new definition need not have any resemblance to the old definition.
However, if an identifier which is currently a macro is redefined, then the new definition must be effectively the same as the old one. Two macro definitions are effectively the same if: <