ANSI standard and cpp
joemu at tekecs.UUCP
joemu at tekecs.UUCP
Thu Oct 4 09:29:34 AEST 1984
I have a question that has sparked heated debate within the committee.
Should benign (identical) redefinition of a macro be allowed?
I think the current draft standard does not allow redefinition of a
macro even if the definitions are identical, or if it does, the result
of identical redefinition is implementation defined.
The reasons for not allowing it are:
1. some implementations "tokenize" the file BEFORE preprocessing. It
makes it very difficult to tell if the macro definition is identical
to a previous definition.
2. several committee members felt that if you were defining a macro more
than once, your source has gotten out of control and it would be
benificial to know if your macro has been defined more than once.
The reasons for allowing redefinition are:
1. It provides a facility to tell if two macros are identical - there is
no other way (I think)
2. Benign redefinition does not hurt anything
3. A lot of U*IX code does it
4. If you want to diagnose benign definition it is easy to do with
#ifdef foo
die
#endif
More information about the Comp.lang.c
mailing list