Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site umcp-cs.UUCP Path: utzoo!linus!philabs!seismo!rlgvax!cvl!umcp-cs!chris From: chris@umcp-cs.UUCP Newsgroups: net.unix Subject: Re: typedefs, etc. - (nf) Message-ID: <4626@umcp-cs.UUCP> Date: Thu, 5-Jan-84 02:04:01 EST Article-I.D.: umcp-cs.4626 Posted: Thu Jan 5 02:04:01 1984 Date-Received: Sat, 14-Jan-84 23:48:19 EST References: <1200@ucbcad.UUCP> <430@bbncca.ARPA> Organization: Univ. of Maryland, Computer Science Dept. Lines: 27 Re: From: keesan@bbncca.UUCP [ Re: ... typedef enum { FALSE, TRUE } bool; ... ] I question the utility of a 'bool' type which generates type-clashes with boolean expressions. However, if you insist on using it, do you object to return( (bool)(getchar() == 'y') ); ? This avoids the type-clash warning, and is guaranteed to work. Unfortunately it's not *guaranteed* to work, unless you use typedef enum { FALSE = 0, TRUE = 1 } bool; to ensure that (bool) 0 == FALSE and (bool) 1 == TRUE. Otherwise the result of a boolean expression may be neither FALSE nor TRUE! Personally I just use integers as boolean-variables. (As if anyone cares.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris.umcp-cs@CSNet-Relay