Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!swrinde!ucsd!pacbell.com!pacbell!sactoh0!jak From: jak@sactoh0.SAC.CA.US (Jay A. Konigsberg) Newsgroups: comp.lang.c Subject: Re: TRUE and FALSE Message-ID: <3835@sactoh0.SAC.CA.US> Date: 29 Aug 90 22:58:09 GMT References: <11215@alice.UUCP> <514@demott.COM> <2316@cirrusl.UUCP> Organization: Sacramento Public Access Unix, Sacramento, Ca. Lines: 37 In article <2316@cirrusl.UUCP> dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) writes: >In <514@demott.COM> kdq@demott.COM (Kevin D. Quitt) writes: >> >>TRUE and FALSE are used for assignment purposes only. It makes >>the intent of the code more obvious. > >When I find somebody who really, really, really wants to define TRUE >and FALSE, even somebody who uses them for assignment only, I recommend >the following defines instead: > > #define ZERO 0 > #define ONE 1 > >These are so much more clear than TRUE and FALSE, and if you use >them in a test, you know exactly what you're testing! >-- Pish-posh! TRUE and FALSE are much clearer. Kevin is correct when he says TRUE and FALSE are used for assignment purposes only. The resulting values are then easly checked in standard C syntax making the code more self-documentating. Personally though, I like the following: #define TRUE -1 Why? Because of the following 8 bit pattern: 1: 01111111 -1: 11111111 I mean, after all, if I'm going to set one I might as well set all :-) -- ------------------------------------------------------------- Jay @ SAC-UNIX, Sacramento, Ca. UUCP=...pacbell!sactoh0!jak If something is worth doing, its worth doing correctly.