Re: Bools and bitfields

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

 



"Paulo J. Matos" <pocmatos@xxxxxxxxx> writes:

> 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.
>
> 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?

Not really, sorry.  gcc doesn't document type sizes, because the
design of gcc is such that they can be target dependent, and for some
targets can even vary based on command line options.

Ian


[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