Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!adam.pika.mit.edu!scs From: scs@adam.pika.mit.edu (Steve Summit) Newsgroups: comp.lang.c Subject: Re: Definition of boolean type Message-ID: <9325@bloom-beacon.MIT.EDU> Date: 19 Feb 89 00:34:34 GMT References: <10@dbase.UUCP> <9609@smoke.BRL.MIL> <3645@arcturus> <15906@mimsy.UUCP> <27989@ucbvax.BERKELEY.EDU> <7698@chinet.chi.il.us> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: scs@adam.pika.mit.edu (Steve Summit) Lines: 24 In article <7698@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes: >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(); >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. How silly. The thing to do is educate those "people who don't like the looks of if(expression)". Who are they, anyway? If an expression is of "conceptual type boolean," and especially if its name reflects it ("inputready()", "break_seen", etc.) then if(expression) is the most natural way to write it. If the expression is not "conceptually boolean," then an explicit comparison is correct and appropriate. Comparison operators can be thought of as converting ints to bools, to be handed to things like "if". Who needs a new operator to convert bools to bools? Steve Summit scs@adam.pika.mit.edu