Versions Compared

Key

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

...

Please note that this noncompliant code example also violates EXP11-C. Do not make assumptions regarding the layout of structures with bit-field structuresfields.

Compliant Solution

Saving a few bits of storage is generally not as important as writing portable code. A struct can be used to provide room for both the pointer and the flag value. This is portable to machines of different word sizes, both smaller and larger than 32 bits, working even when pointers cannot be represented in any integer type.

...