Path: utzoo!mnetor!uunet!husc6!endor!olson From: olson@endor.harvard.edu (Eric K. Olson) Newsgroups: comp.sys.mac Subject: Re: LSC: booleans != TRUE ?? Message-ID: <4097@husc6.harvard.edu> Date: 22 Feb 88 15:28:19 GMT References: Sender: news@husc6.harvard.edu Reply-To: olson@endor.UUCP (Eric K. Olson) Organization: Lexington Software Design, Lexington, MA Lines: 38 In a recent article Richard Siegel writes: [In reply to a question about why a comparision of a Boolean didn't work] >The macro definitions for TRUE and FALSE are in . Be sure you're >including it. Do a multiple-file search and be CERTAIN you're not changing >macros. > >In LightspeedC, TRUE is one and FALSE is zero. The original question contained a statement like: if (functionreturningboolean()==TRUE) ... If memory serves me correctly, portions of the Mac OS use the highest order (sign) bit for the state of a Boolean, a Pascalism, I think (forgive me if this isn't quite exact). I prefer to define TRUE as -1 for this reason, so that the Mac won't be confused when I pass it a Boolean. A safe assumption is that FALSE==0, both in C and in Mac. I use 0L and it gets coerced to a short in most cases. But you shouldn't compare a Boolean anyway. The statement above can be replaced by: if (functionreturningboolean()) ... or if (!functionreturingboolean()) ... instead of if (functionreturningboolean()==FALSE) ... -Eric "We're writing tomorrow's software yesterday." Eric K. Olson olson@endor.harvard.edu harvard!endor!olson D0760 (Name) (ArpaNet) (UseNet) (AppleLink)