Path: utzoo!utgpu!watmath!att!dptg!rutgers!gatech!ncar!ico!ism780c!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Atomic #defines (was Re: Password checking program) Message-ID: <14480@haddock.ima.isc.com> Date: 31 Aug 89 00:30:19 GMT References: <15257@duke.cs.duke.edu> <652@lakart.UUCP> <10765@smoke.BRL.MIL> <1625@mcgill-vision.UUCP> <13899@bloom-beacon.MIT.EDU> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 16 In article <13899@bloom-beacon.MIT.EDU> scs@adam.pika.mit.edu (Steve Summit) writes: >I didn't want to require that 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 itself. It occurs to me that > #ifndef EOF > #include > #endif >is probably a safe way to protect against a non-idempotent ...) 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@haddock.isc.com), The Walking Lint