Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cwjcc!gatech!mcdchg!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.lang.c Subject: Re: Definition of boolean type Message-ID: <7698@chinet.chi.il.us> Date: 12 Feb 89 22:30:15 GMT References: <10@dbase.UUCP> <9609@smoke.BRL.MIL> <3645@arcturus> <15906@mimsy.UUCP> <27989@ucbvax.BERKELEY.EDU> Reply-To: les@chinet.chi.il.us (Leslie Mikesell) Organization: Chinet - Public Access Unix Lines: 21 In article <27989@ucbvax.BERKELEY.EDU> jas@ernie.Berkeley.EDU.UUCP (Jim Shankland) writes: >I agree with Karl Heuer: C would have benefited from a built-in boolean >type. Or perhaps a boolean equality operator for people who don't like the looks of: (1) if (expression) action(); and prefer: (2) if (expression == SOMETHING) action(); and who don't like: (3) if (expression != 0) action(); Method (2) would work (and look better to some people) if C had a boolean equality operator that would evaluate false only when one of the operands is zero and one non-zero. This would have an advantage over a separate data type in that you would not have to convert the return values from all those functions that return 0 for failure, some (useful, non-boolean) value on success. Les Mikesell