lkml.org 
[lkml]   [2002]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: RFC: booleans and the kernel
Date
Followup to:  <3C5047A2.1AB65595@mandrakesoft.com>
By author: Jeff Garzik <jgarzik@mandrakesoft.com>
In newsgroup: linux.dev.kernel
>
> A small issue...
>
> C99 introduced _Bool as a builtin type. The gcc patch for it went into
> cvs around Dec 2000. Any objections to propagating this type and usage
> of 'true' and 'false' around the kernel?
>
> 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].
>
> Actually I prefer 'bool' to '_Bool', if this becomes a kernel standard.
>

Noone is actually meant to use _Bool, except perhaps in header files.

#include <stdbool.h>

... then use "bool", "true", "false".

This is fine with me as long our version of stdbool.h contain the
appropriate ifdefs.

-hpa
--
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt <amsp@zytor.com>
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:15    [W:0.181 / U:0.936 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site