Path: utzoo!attcan!uunet!sco!seanf From: seanf@sco.COM (Sean Fagan) Newsgroups: comp.lang.c Subject: Re: BOOLEAN as enum Keywords: TRUE, FALSE, Booleans Message-ID: <5617@scolex.sco.COM> Date: 11 Apr 90 14:05:01 GMT References: <1199@gtx.com> <5636@jarthur.Claremont.EDU> <1990Apr2.162524.26586@dinorah.wustl.edu> <16379@haddock.ima.isc.com> <733@chem.ucsd.EDU> <986@mti.mti.com> Sender: news@sco.COM Reply-To: seanf@sco.COM (Sean Fagan) Organization: The Santa Cruz Operation, Inc. Lines: 31 In article <986@mti.mti.com> adrian@mti.UUCP (Adrian McCarthy) writes: > if (!strcmp(s1,s2)) /* YUCK!!! */ Why "YUCK!!!"? This is perfectly reasonable code, with wide-spread usage. To me, it's now more readable than "if (strcmp (s1, s2) == 0)", although I will admit I'm a bit weird. >what the function does and didn't mistake for a boolean function. Oh. I see. You simply don't understand C. Now I understand your post. >Assuming: f1 = fopen("data.dat","r"); test like this: > > if (f1 = NULL) { /* handle error */ } >not like this: > if (!f1) { /* handle error */ } Of course not; these mean two different things. >Similary: if (count > 0) {}, not: if (count) {}. These are only equal if count is unsigned, unless the programmer *knows* that count will never be negative. -- -----------------+ Sean Eric Fagan | "It's a pity the universe doesn't use [a] segmented seanf@sco.COM | architecture with a protected mode." uunet!sco!seanf | -- Rich Cook, _Wizard's Bane_ (408) 458-1422 | Any opinions expressed are my own, not my employers'.