Re: Bools and bitfields

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

 



On Sat, Dec 12, 2009 at 2:29 AM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote:
>
> sizeof(bool) == 1 but the type is nevertheless just 1 bit wide.  The
> only valid values to store in a bool are 0 and 1.  It doesn't make
> sense to have a bool field that is 2 bits wide, as you can still only
> store 0 and 1 in it.
>
> Ian
>

Hi Ian,

Thanks for clarifying. Indeed, I got the impression that it would be
1bit wide, however how can you know this without looking into the gcc
code? I searched the documentation in the implementation dependent
details and searched the documentation for a function that would give
me the number of bits of a type, but couldn't find anything.

Any tips on this?

Thanks,
-- 
Paulo Jorge Matos - pocmatos at gmail.com
http://www.pmatos.net


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux