Re: Bit Field Formations

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

 



Crescioli, Phil wrote:

If I create a structure that includes bit-field definitions, how are the
bit fields assigned within a word. In the example below, is variable x1
assigned to bits 31-28 or bits 3-0? My assumption is that the fields are
assigned in order so that the example produces either:

I believe that is implementation-defined. The compiler is free to use any method it likes to pack the bits into the structure. In fact, the identical compiler may organize the bits differently based on the architecture's endianness and alignment restrictions.


In other words, bitfields cannot be used reliably (if at all) for things that must be communicated outside the process the code is running in (except for another process running the same code on the same box, of course).

[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