Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Mar 2002 04:14:09 +0000
From:      Tony Finch <dot@dotat.at>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        Mike Meyer <mwm-dated-1015831171.a21ab0@mired.org>, obrien@FreeBSD.ORG, Giorgos Keramidas <keramida@FreeBSD.ORG>, hackers@FreeBSD.ORG
Subject:   Re: RFC: style(9) isn't explicit about booleans for testing.
Message-ID:  <20020307041409.B29816@chiark.greenend.org.uk>
In-Reply-To: <88752.1015400044@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
Poul-Henning Kamp <phk@critter.freebsd.dk> wrote:
>
>I had a discussion with Eric Allman about this very thing recently
>where he advocated "everything inside if, while, for and so on should
>be true booleans".
>
>Now, IFF the C language had a type called "boolean" that would make
>a lot of sense.
>
>Unfortunately, it does not (at present ?) have a boolean type, and
>while one could simulate it with typedefs, there is no way to get
>the compiler to enforce the rule.

C99 has a boolean type, but neither the comparison operators nor the
logical operators nor the ! operator return a bool, and conditional
contexts (like if, while, ?:) don't expect a bool.

Pretty useless, really.

Tony.
-- 
f.a.n.finch <dot@dotat.at>
ROCKALL: WEST BACKING SOUTHWEST 6 TO GALE 8, OCCASIONALLY SEVERE GALE 9 AT
FIRST, DECREASING 5 FOR A TIME. OCCASIONAL RAIN. MODERATE.

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?20020307041409.B29816>