Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 Mar 2002 23:00:59 -0700 (MST)
From:      "M. Warner Losh" <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.
Message-ID:  <20020306.230059.128109706.imp@village.org>
In-Reply-To: <p05101510b8ac2005b34b@[128.113.24.47]>
References:  <26424.1015440592@critter.freebsd.dk> <p05101510b8ac2005b34b@[128.113.24.47]>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <p05101510b8ac2005b34b@[128.113.24.47]>
            Garance A Drosihn <drosih@rpi.edu> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020306.230059.128109706.imp>