[cfe-dev] Inconsistent types used to represent bitwidth

Cédric Venet cedric.venet at student.ecp.fr
Thu Oct 4 07:44:24 PDT 2007


>> >
>> > IIUC, the bitwidth is most of the time the number of bits needed to
>> > represent the size, i.e. 32 for uint32_t. In this case 64 is the
>> > largest number these kind of variables will ever hold, no?
>>
>> Yes, except that what is the size of "uint32_t[100000000000LL]" ?
>
>    sizeof(uint32_t[100000000000LL]) < 2^64,
>
> so the size is representable with 64 bits, which means the corresponding
> bitwidth is not even '64', which conveniently fits into a int8_t.
>
> But probably I'm getting something really wrong here.
> Regards Hartmut

I think we lost the correct definition of bitwith along the way.  
quoting earlier post from this thread:

> >>> recognized, that the bitwith (size of a type in bits) is

for me, bitwith( X ) == 8*sizeof( X )

If we speak of the same things, this was done in order to thread the  
size of bitfield member in an uniform manner with other 'normal'  
variable.

regards,

-- 
Cédric





More information about the cfe-dev mailing list