GNU Info

Info Node: (cpp-295.info)Redefining

(cpp-295.info)Redefining


Next: Macro Pitfalls Prev: Undefining Up: Macros
Enter node , (file) or (file)node

Redefining Macros
-----------------

   "Redefining" a macro means defining (with `#define') a name that is
already defined as a macro.

   A redefinition is trivial if the new definition is transparently
identical to the old one.  You probably wouldn't deliberately write a
trivial redefinition, but they can happen automatically when a header
file is included more than once (Note: Header Files.), so they are
accepted silently and without effect.

   Nontrivial redefinition is considered likely to be an error, so it
provokes a warning message from the preprocessor.  However, sometimes it
is useful to change the definition of a macro in mid-compilation.  You
can inhibit the warning by undefining the macro with `#undef' before the
second definition.

   In order for a redefinition to be trivial, the new definition must
exactly match the one already in effect, with two possible exceptions:

   * Whitespace may be added or deleted at the beginning or the end.

   * Whitespace may be changed in the middle (but not inside strings).
     However, it may not be eliminated entirely, and it may not be added
     where there was no whitespace at all.

   Recall that a comment counts as whitespace.


automatically generated by info2www version 1.2.2.9