Re: [PATCH 1/4] staging: comedi: make 'dev->attached' a bool bit-field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2013-03-15 16:43, H Hartley Sweeten wrote:

I guess the real question is, what's the underlying type of a bool?
It must be an unsigned "something" or the compiler would complain.
And does assigning a bit field to the bool actually save any space?

<linux/types.h>	typedef _Bool bool;

_Bool is a standard type in C99

I found this:

http://gcc.gnu.org/ml/gcc-patches/2000-10/msg01127.html

But honestly still don't know what a _Bool is... :-)

It's a special unsigned integer type. Converting any scalar value to _Bool should produce 0 or 1 (false or true). Assigning a scalar value to a _Bool involves such a conversion so the value 0 or 1 should be stored no matter what try and store in there. _Bool bit-fields aren't the same as the _Bool type though, and the standard only says what shall happen if you store the value 0 or 1 in there and doesn't say what happens if you store a different value in there.

Search for n869.pdf if interested. That's only a draft of the C99 standard, but is the closest you'll find to the actual standard without shelling out the dosh for the actual standard.

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux