From owner-freebsd-hackers Wed Mar 6 19:27: 4 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from dragon.nuxi.com (trang.nuxi.com [66.92.13.169]) by hub.freebsd.org (Postfix) with ESMTP id 35FB137B41E for ; Wed, 6 Mar 2002 19:26:54 -0800 (PST) Received: (from obrien@localhost) by dragon.nuxi.com (8.11.6/8.11.1) id g273QbM55388; Wed, 6 Mar 2002 19:26:37 -0800 (PST) (envelope-from obrien) Date: Wed, 6 Mar 2002 19:22:34 -0800 From: "David O'Brien" To: Garance A Drosihn Cc: Poul-Henning Kamp , Mike Meyer , hackers@FreeBSD.ORG Subject: Re: RFC: style(9) isn't explicit about booleans for testing. Message-ID: <20020306192234.B55297@dragon.nuxi.com> Reply-To: obrien@FreeBSD.ORG References: <26424.1015440592@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from drosih@rpi.edu on Wed, Mar 06, 2002 at 02:37:45PM -0500 X-Operating-System: FreeBSD 5.0-CURRENT Organization: The NUXI BSD group X-Pgp-Rsa-Fingerprint: B7 4D 3E E9 11 39 5F A3 90 76 5D 69 58 D9 98 7A X-Pgp-Rsa-Keyid: 1024/34F9F9D5 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Mar 06, 2002 at 02:37:45PM -0500, Garance A Drosihn wrote: > At 7:49 PM +0100 3/6/02, Poul-Henning Kamp wrote: > >Garance A Drosihn writes: > > >In one message, > >> At 12:52 AM -0800 3/6/02, David O'Brien wrote: > >>>I don't think it is clarifying a rule. I think it is in fact adding > >>>a rule. You are extrapolating too much I think. All the rule is > >>>trying to prevent is "if (!strcmp(a,b))" which when read is extremely > > >>wrong of that is actually happening. > > > > > >If we change boolean to integer, then the proposed rule will not > >>prevent "if (!strcmp(a,b))" , because strcmp() *does* return an > >>integer value. Or am I missing something here? > > > >Right, and since the integer is well defined, > > if (!strcmp(a, b)) > >is perfectly understandable so what is the problem ? > > Well, that's my question. David's comment implies that it is not > good to do '!strcmp()', and I was wondering why it is not good... Implies??? I thought I was quite explicit: to prevent is "if (!strcmp(a,b))" which when read is extremely wrong of that is actually happening. ! is pronounced "NOT". When read "if not string compare a with b then do X", is the opposite of the the logic of the expression does. Which is "if string compare a with b is equal then do X". ["if (strcmp(a,b) == 0)"] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message