On Thu, 16 Mar 2006, Jan Engelhardt wrote:
> >> of course. but that it's not used in core code implies this opinion is
> >> widely shared.
> >
> >[...] To me it is a simple consequence of there not
> >being a boolean type in the kernel so you cannot use it in the core code.
>
> typedef bool int;
You mean typedef int bool...
That (or its derivative) is what at least 69 places in the kernel do
already. That is the whole point of discussion! The point is to unify it
all into a kernel common place. I just suggested that using the compiler
provided _Bool was better than using int.
> And then happily use if(EXPR) and if(!EXPR) instead of if(EXPR == TRUE) or
> if(EXPR == FALSE). :-)
Obviously. No-one here is suggesting to use if (EXPR == TRUE) that is
crazy. You would use if (EXPR) no matter what type you use. Technically
only a boolean type should be used like that. The fact it works for an
int is concidence because false = 0 and true = 1.
The point is 1) when assigning, you assign x = FALSE; rather than x = 0;
which means nothing (it could be a counter you are initializing, no way to
tell) and 2) for return values from functions and parameters to functions
so it is easier to understand the semantics of the function.
Best regards,
Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]