Atomic #defines (was Re: Password checking program)
Karl Heuer
karl at haddock.ima.isc.com
Thu Aug 31 10:30:19 AEST 1989
In article <13899 at bloom-beacon.MIT.EDU> scs at adam.pika.mit.edu (Steve Summit) writes:
>I didn't want to require that <stdio.h> be #included before the header file
>that was trying to #define ERROR. (I can't yet depend on ANSI's guarantee
>that multiple #inclusions of standard header files are safe, so I didn't have
>the header file in question #include <stdio.h> itself. It occurs to me that
> #ifndef EOF
> #include <stdio.h>
> #endif
>is probably a safe way to protect against a non-idempotent <stdio.h>...)
It works correctly if the user has already done the #include, or if they omit
it entirely, but not if they do it *after* #include'g your header. The user
needs to be warned not to do that; you can't defend against it without having
write permission to stdio.h.
Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint
More information about the Comp.lang.c
mailing list