Newsgroups: comp.lang.c++ Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!stanford.edu!neon.Stanford.EDU!pescadero.Stanford.EDU!philip From: philip@pescadero.Stanford.EDU (Philip Machanick) Subject: Re: Boolean confusion Message-ID: <1991May29.171209.14760@neon.Stanford.EDU> Sender: news@neon.Stanford.EDU (USENET News System) Reply-To: philip@pescadero.stanford.edu Organization: Stanford University References: <332@nazgul.UUCP> <1991May29.145100.18519@watson.ibm.com> Distribution: comp.lang.c++ Date: Wed, 29 May 1991 17:12:09 GMT Lines: 22 In article <1991May29.145100.18519@watson.ibm.com>, mittle@blinn.watson.ibm.com (Josh Mittleman) writes: |> |> > Note that you also need to get rid of any TRUE or FALSE #define's. |> Remember to |> > always test for 0 or !=0. |> > |> > (Some other battle-scarred old C programmers have told me that they have |> > eventually come to the same conclusions.) |> |> But that's exactly the point: Testing for == 0 is the perfect C approach, |> but it entirely inconsistent with the logic of C++. C++ should have a |> standard built-in Boolean type. Yes - maybe it would also catch a lot of those annoying hard to find bugs caused by typing "if (thing = whatever)" instead of "==". But how many programs would break? I for one would be prepared to pay the price for the long-term gain, but I generally try to program as if boolean and int are distinct types, so the price wouldn't be very high for me. -- Philip Machanick philip@pescadero.stanford.edu