mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, aia21@cantab.net, len.brown@intel.com
Subject: Re: [patch 1/1] consolidate TRUE and FALSE
Date: Thu, 16 Mar 2006 13:26:39 -0800	[thread overview]
Message-ID: <20060316132639.274691d6.akpm@osdl.org> (raw)
In-Reply-To: <20060316164932.GT27946@ftp.linux.org.uk>

Al Viro <viro@ftp.linux.org.uk> wrote:
>
> On Thu, Mar 16, 2006 at 02:01:28AM -0800, akpm@osdl.org wrote:
>  > 
>  > From: Andrew Morton <akpm@osdl.org>
>  > 
>  > We have no less than 65 implementations of TRUE and FALSE in the tree, so the
>  > inevitable happened:
>  > 
>  > In file included from drivers/pci/hotplug/ibmphp_core.c:40:
>  > drivers/pci/hotplug/ibmphp.h:409:1: warning: "FALSE" redefined
>  > In file included from include/acpi/acpi.h:55,
>  >                  from drivers/pci/hotplug/pci_hotplug.h:187,
>  >                  from drivers/pci/hotplug/ibmphp.h:33,
>  >                  from drivers/pci/hotplug/ibmphp_core.c:40:
>  > include/acpi/actypes.h:336:1: warning: this is the location of the previous definition
>  > 
>  > The patch implements TRUE and FALSE in include/linux/kernel.h and removes all
>  > the private versions.
> 
>  NAK.  Simply remove those and be done with that.  It's bad style and we
>  certainly don't need to propagate that lossage.

No, it is not bad style.

It is bad that the C design failed to distinguish between booleans and
scalars.  These are quite different concepts and it is a gruesome kludge to
go and use a scalar when a boolean is what was intended.

There are readability (and hence maintainability) advantages in using
boolean types for boolean variables.

Yes, the use of scalars in this manner is an (ancient, old-fashioned) C
idiom.  But it is one which was forced on us by shortcomings in the
language.  Times change.  Just because something is idiomatic doesn't mean
that it is either good or right.  If C had had proper boolean support back
in the old days then using scalars as booleans would be frowned upon.

C99 does have boolean support, so the proper thing to do is to start
using it - implement stdbool.h, fix up fallout, start fixing subsystems. 
Given that, and as Greg has fixed up this particular build error I'll drop
the patch.

(It's a shame that the compiler doesn't preperly enforce boolean
typechecking, but sparse could do that).

  reply	other threads:[~2006-03-16 21:29 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-16 10:01 akpm
2006-03-16 10:28 ` Anton Altaparmakov
2006-03-16 10:42   ` Andrew Morton
2006-03-16 19:55     ` Nicholas Miell
2006-03-16 19:55     ` Jan Engelhardt
2006-03-16 10:36 ` Arjan van de Ven
2006-03-16 16:01 ` Christoph Hellwig
2006-03-16 16:29   ` Randy.Dunlap
2006-03-16 16:30     ` Christoph Hellwig
2006-03-16 16:36       ` Randy.Dunlap
2006-03-16 16:36         ` Christoph Hellwig
2006-03-16 16:42           ` Anton Altaparmakov
2006-03-16 16:50             ` Al Viro
     [not found]               ` <2c0942db0603160905v26011d8dx1e64967b2eb4deac@mail.gmail.com>
2006-03-16 17:11                 ` Al Viro
2006-03-16 18:50               ` Anton Altaparmakov
2006-03-16 18:53                 ` Anton Altaparmakov
2006-03-16 19:59             ` Jan Engelhardt
2006-03-16 22:35               ` Anton Altaparmakov
2006-03-16 16:42           ` Randy.Dunlap
2006-03-16 16:39       ` Anton Altaparmakov
2006-03-16 17:41       ` Sam Ravnborg
2006-03-16 18:00         ` Al Viro
2006-03-16 18:12           ` Randy.Dunlap
2006-03-16 18:49             ` Al Viro
2006-03-16 18:58               ` Randy.Dunlap
2006-03-16 18:52           ` Sam Ravnborg
2006-03-16 21:17     ` Valdis.Kletnieks
2006-03-16 21:28       ` Joshua Hudson
2006-03-16 23:53     ` David Wagner
2006-03-16 17:09   ` Xavier Bestel
2006-03-16 16:49 ` Al Viro
2006-03-16 21:26   ` Andrew Morton [this message]
2006-03-17 22:43     ` Xavier Bestel
2006-03-17 22:56       ` Andrew Morton
2006-03-18 21:57       ` Jan Engelhardt
2006-03-19 11:41         ` Xavier Bestel
2006-03-16 17:07 ` Greg KH
2006-03-16 17:13   ` Greg KH
2006-03-20 14:46 ` Richard Knutsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060316132639.274691d6.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=aia21@cantab.net \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®