Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 24 Jan 2002 15:06:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 24 Jan 2002 15:06:39 -0500 Received: from waste.org ([209.173.204.2]:1186 "EHLO waste.org") by vger.kernel.org with ESMTP id ; Thu, 24 Jan 2002 15:06:26 -0500 Date: Thu, 24 Jan 2002 14:06:23 -0600 (CST) From: Oliver Xymoron To: Jeff Garzik cc: Linux-Kernel list Subject: Re: RFC: booleans and the kernel In-Reply-To: <3C50688B.E87B421F@mandrakesoft.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 Jan 2002, Jeff Garzik wrote: > Oliver Xymoron wrote: > > On Thu, 24 Jan 2002, Jeff Garzik wrote: > > > Where variables are truly boolean use of a bool type makes the > > > intentions of the code more clear. And it also gives the compiler a > > > slightly better chance to optimize code [I suspect]. > > > > Unlikely. The compiler can already figure this sort of thing out from > > context. > > X, true, and false are of type int. > If one tests X==false and then later on tests X==true, how does the > compiler know the entire domain has been tested? Because you never test against X==true. You always test X!=false. This is the C way. > Or a switch statement... if both true and false are covered, > there is no need for a 'default'. Your cases are false and default. -- "Love the dolphins," she advised him. "Write by W.A.S.T.E.." - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/