Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!netcomsv!sjsumcs!horstman From: horstman@mathcs.sjsu.edu (Cay Horstmann) Newsgroups: comp.lang.c++ Subject: Re: Boolean confusion Message-ID: <1991May24.031554.1805@mathcs.sjsu.edu> Date: 24 May 91 03:15:54 GMT References: Distribution: comp.lang.c++ Organization: San Jose State University - Math/CS Dept. Lines: 27 In article haydens@natasha.juliet.ll.mit.edu (Hayden Schultz) writes: > >The best I can think of right now is to always include "foreign" >include files first, then my own. In my own include files I can do >something like: > >#ifdef Bool >#undef Bool >#endif >typedef enum {FALSE, TRUE} Bool; > Don't do that. In C++, enums aren't ints. For example, the code Bool more, done; // ... more = !done && cin.good(); will not compile--the right hand side of the = (the result of &&) is an int, and it cannot be assigned to an enum without a cast more = (Bool)(!done && cin.good()); // bleecch Cay > > Thanks, > > Hayden Schultz (haydens@juliet.ll.mit.edu) > MIT Lincoln Lab > (617) 981-3685