Versions Compared

Key

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

...

The type of the bit-field when used in an expression also has implications for long and long long types. Compilers that follow the second interpretation of the standard and determine the size from the width of the
bit-field will promote values of these types to int. For example, gcc interprets the following as an eight bit value and promote it to int:

...

The following attributes of bit-fields are also implementation 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?

...