From owner-freebsd-hackers Wed Mar 6 20:14:20 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from chiark.greenend.org.uk (chiark.greenend.org.uk [212.22.195.2]) by hub.freebsd.org (Postfix) with ESMTP id 9ACD437B400; Wed, 6 Mar 2002 20:14:16 -0800 (PST) Received: from fanf by chiark.greenend.org.uk with local (Exim 3.12 #1) id 16ipI9-0007zC-00 (Debian); Thu, 07 Mar 2002 04:14:09 +0000 Date: Thu, 7 Mar 2002 04:14:09 +0000 From: Tony Finch To: Poul-Henning Kamp Cc: Mike Meyer , obrien@FreeBSD.ORG, Giorgos Keramidas , hackers@FreeBSD.ORG Subject: Re: RFC: style(9) isn't explicit about booleans for testing. Message-ID: <20020307041409.B29816@chiark.greenend.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <88752.1015400044@critter.freebsd.dk> 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 Poul-Henning Kamp 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 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