Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ucbvax!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!icdoc!dbh From: dbh@doc.ic.ac.uk (Denis Howe) Newsgroups: comp.sys.acorn Subject: Re: C release 3 preprocessor bug ?? Message-ID: Date: 17 May 91 11:37:26 GMT References: <1991May16.125325.15323@doc.ic.ac.uk> Organization: Dept. of Computing, Imperial College, London, UK Lines: 44 Nntp-Posting-Host: asun4.doc.ic.ac.uk In-Reply-To: mybg@doc.ic.ac.uk's message of Thu, 16 May 1991 12:53:25 GMT In article <1991May16.125325.15323@doc.ic.ac.uk> Michael Ben-Gershon asks: >Am I crazy, or is there a subtle bug in C release 3? You cannot be that crazy if you use an Arc, but then again, you are at Imperial ;-) My understanding of the C pre-processor which agrees with that of cpp of SunOS 4.1 here and HP-UX (both /lib/cpp and /lib/cpp.ansi) is that an undefined macro is only 0 in pre-processor evaluated expressions (after #if, as opposed to #ifdef) so if UNDEFINED is not defined: #if UNDEFINED == 0 This will be included. #endif or #if UNDEFINED+1 == 1 (also true) so #if UNDEFINED This will not be included. #else But this will. #endif If a macro is defined as 0 then it is defined! So #define ZERO 0 #ifdef ZERO This will be included. #endif To turn off #ifdef VAX use #undef VAX after the point where VAX is defined or simpler still, just don't define it! Does this help? -- Denis Howe C-C H558A Imperial College London C-C-C +44 (71) 589 5111 x5064 N=N