[PATCH] dix: do not use bit-wise operators on the boolean result of BitIsOn

Ferry Huberts ferry.huberts at pelagic.nl
Wed Dec 1 04:27:49 PST 2010


On 12/01/2010 12:17 PM, Mark Kettenis wrote:
>
> The idea that C has a boolean type is a mere illusion.  Even the _Bool
> type introduced in C99 is classified as an unsigned integer type.
>

We all agree on that I think.

I suppose the idea is that a boolean is layered on top
(or is a derived/sub class) of an unsigned integer and that using
the base (parent) type i.s.o. the actual type is a mistake.

Booleans are logical values types and must be used as such.

>
> In the C language that is defenitely not an implementation detail!
>

I checked the C language spec but couldn't find anything pertaining
to booleans, therefore it's an implementation detail.

> That said, since the !! change to BitIsOn was deemed desirable by some
> people, this diff is a logical consequence.
>

Maybe the '!!' should actually be replaced by the comparison '!= 0' to
make it explicit that the result is a boolean, i.s.o. this funky arithmetic

It's a logical consequence yes.
And a lot of words over such a small patch :-)


Ferry


More information about the xorg-devel mailing list