Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!usc!snorkelwacker!apple!uokmax!munnari.oz.au!csource!david From: david@csource.oz.au (david nugent) Newsgroups: comp.lang.c Subject: Re: TRUE and FALSE Message-ID: <664@csource.oz.au> Date: 27 Aug 90 19:44:54 GMT References: <11215@alice.UUCP> <514@demott.COM> Reply-To: david@csource.oz.au Organization: Unique Computing Pty Ltd, Melb, Aust. Lines: 46 In <514@demott.COM> kdq@demott.COM (Kevin D. Quitt) writes: > >Unfortunately, using TRUE and FALSE opens a great gaping hole: > >one would expect that > > > > x == TRUE > > > >would mean the same as > > > > x != FALSE > > > >but of course it doesn't -- at least not if you use the usual C > >convention that 0 is false and any other value is true. > We use > #define TRUE (1==1) > #define FALSE (1!=1) > defined that way for hysterical raisins (broken compiler). We are > aware of the problem above, and never test booleans that way. TRUE and > FALSE are used for assignment purposes only. It makes the intent of the > code more obvious. Shouldn't # define FALSE 0 # define TRUE (!FALSE) _always_ work? I have been using this for a considerable amount of time, and so far haven't seen any problems with it. Or are there some circumstances where this might not cover all cases? Regards, david -- Fidonet: 3:632/348 SIGnet: 28:4100/1 Imex: 90:833/387 Data: +61-3-885-7864 Voice: +61-3-826-6711 Internet/ACSnet: david@csource.oz.au Uucp: ..!uunet!munnari!csource!david