All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Knutsson <ricknu-0@student.ltu.se>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] standardizing on boolean variables?
Date: Sun, 21 Jan 2007 10:58:28 +0000	[thread overview]
Message-ID: <45B34754.5060908@student.ltu.se> (raw)
In-Reply-To: <Pine.LNX.4.64.0701210324380.13751@CPE00045a9c397f-CM001225dbafb6>

Robert P. J. Day wrote:
> On Sun, 21 Jan 2007, Alexey Dobriyan wrote:
>
>   
>> On Sun, Jan 21, 2007 at 03:36:33AM -0500, Robert P. J. Day wrote:
>>     
>>> p.s.  the source file drivers/scsi/BusLogic.c repeatedly refers to the
>>> token "true", but it's not clear where *that's" being defined.  goes
>>> gcc actually recognize the token "true"?  that's supposed to be
>>> defined in C99's <stdbool.h>, but that's clearly not being used here.
>>>       
>> When in doubt see preprocessor output:
>>
>> 	make drivers/scsi/BusLogic.i
>>
>> 	# 1 "/home/linux/linux-irq-flags-t/include/linux/stddef.h" 1
>> 	# 15 "/home/linux/linux-irq-flags-t/include/linux/stddef.h"
>> 	enum {
>> 	 false = 0,
>> 	 true = 1
>> 	};
>>
>> Indeed, "true" is right there.
>>     
>
> ah, quite right, i missed that.  but that, of course, just raises
> another question -- why have two different sets of tokens representing
> boolean values?  should programmers use the upper or lower case form?
> and why did the person who wrote BusLogic.c do it differently from
> everyone else?  so many pedantic, anal-retentive questions.
>   
Simple, some people defines 'FALSE'/'TRUE' and some 'false'/'true' ;)
Then, to be able to compile, the 
"6e21828743247270d09a86756a0c11702500dbfb" (git show) redefined BusLogic.h's

-typedef enum { false, true } __attribute__ ((packed)) boolean;

to

+typedef bool boolean;

Also, NTFS has been converted and some more filesystems.
> but back to the question at hand -- is there any fundamental problem
> with trying to define a standard by defining TRUE and FALSE macros in
> types.h?  certainly, that would also require some simultaneous fixes
> to the source tree, where those new macros would clash with existing
> code, like in drivers/net/wireless/strip.c, where one would have to
> remove the conflicting:
>
>   enum { FALSE = 0, TRUE = 1 };
>
> but i'm guessing things like that would be rare.
>   
Please, try to convert it to 'false'/'true' instead. It is meant to be 
the generic boolean-values, same as bool being the type.
Believe it is approved since I saw a patch, adding a function using bool 
and 'false'/'true', signed-off-by Torvalds and Morton (not sure it was a 
third name).

I have not got too much done in the converting-front (some wants it 
changed to int/0/1 instead); maybe this is something to add on Wiki- ToDo :)

Richard Knutsson

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2007-01-21 10:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-21  8:36 [KJ] standardizing on boolean variables? Robert P. J. Day
2007-01-21  9:02 ` Alexey Dobriyan
2007-01-21  9:30 ` Robert P. J. Day
2007-01-21 10:36 ` Tobias Klauser
2007-01-21 10:58 ` Richard Knutsson [this message]
2007-01-21 11:30 ` Robert P. J. Day
2007-01-21 11:54 ` Robert P. J. Day
2007-01-21 12:29 ` Richard Knutsson
2007-01-21 12:47 ` Robert P. J. Day
2007-01-22  8:08 ` Robert P. J. Day
2007-01-22  9:03 ` Richard Knutsson
2007-01-22  9:15 ` Robert P. J. Day
2007-01-22 10:00 ` Robert P. J. Day

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=45B34754.5060908@student.ltu.se \
    --to=ricknu-0@student.ltu.se \
    --cc=kernel-janitors@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.