From owner-freebsd-hackers Wed Mar 6 22: 1:18 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from rover.village.org (rover.bsdimp.com [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id 2397C37B400 for ; Wed, 6 Mar 2002 22:01:13 -0800 (PST) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.11.3/8.11.3) with ESMTP id g2761Bi89673; Wed, 6 Mar 2002 23:01:12 -0700 (MST) (envelope-from imp@village.org) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.11.6/8.11.6) with ESMTP id g27616L90575; Wed, 6 Mar 2002 23:01:06 -0700 (MST) (envelope-from imp@village.org) Date: Wed, 06 Mar 2002 23:00:59 -0700 (MST) Message-Id: <20020306.230059.128109706.imp@village.org> To: drosih@rpi.edu Cc: phk@critter.freebsd.dk, mwm-dated-1015843484.1eabc5@mired.org, hackers@FreeBSD.ORG Subject: Re: RFC: style(9) isn't explicit about booleans for testing. From: "M. Warner Losh" In-Reply-To: References: <26424.1015440592@critter.freebsd.dk> X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 In message: Garance A Drosihn writes: : 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... if (strcmp()) is the problem with if (!strcmp()) Which one is right? The first one should mean "are the same" but really means "are different" and likewise for the second one. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message