Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!uunet!pilchuck!dataio!fnx!nazgul!bright From: bright@nazgul.UUCP (Walter Bright) Newsgroups: comp.lang.c++ Subject: Re: Boolean confusion Message-ID: <332@nazgul.UUCP> Date: 25 May 91 17:32:55 GMT Article-I.D.: nazgul.332 References: Reply-To: bright@nazgul.UUCP (Walter Bright) Distribution: comp.lang.c++ Organization: Zortech, Seattle Lines: 28 In article haydens@natasha.juliet.ll.mit.edu (Hayden Schultz) writes: /So my question is, how can I choose one definition (my own, or someone /else's) for boolean variables, and still remain insulated from the sea /of boolean definitions in assorted include files? /What's the best way to do this? After years of fiddling around with various schemes myself, the most practical one I came up with is just use int: /********************* * Test some quantity. * Returns: * 0 False * !=0 True */ int func(); I've gone through my code over time and have eliminated all the logical, bool, boolean, BOOL, etc. clutter. Although the above solution seems boring and inelegant, it works suprisingly well, given that it mimics C's idea of what is true and what is false. 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.)