Re: A bit field's length

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

 



kum <a.kumaresh@xxxxxxxxx> writes:

> On a 32 bit platform,
> Is this structure legal?
> 
> struct
> {
> UINT64 part1 : 48;
> UINT64 part2 : 16;
> }Parts;

gcc accepts that.  It is not portable C--the C99 standard only
requires the compiler to support bitfields of type _Bool, int, or
unsigned int.

> Do I have to tune the compiler to pack them into a single 64 bit
> space?

No.

> While assigning some 32 bit value to Parts.part1, do I have to
> cast the r-value into UINT64?

No, the cast will happen automatically.

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