Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
struct {
    unsigned long long a:8;
} ull = {255};

The following attributes of bit-fields are also implemention defined:

  • The alignment of bit fields in the storage unit. For example, the bit fields may be allocated from the high end or the low end of the storage unit.
  • Whether or not bit-fields can overlap an storage unit boundary. For example, assuming eight bits to a byte, if bit-fields of six and four bits are declared, is each bitfield contained within a byte or are they be split across multiple bytes?

Resultantly, it is impossible to write portable code that makes assumptions about the layout of bit-fields structures.

References