Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated references from C11->C23

The C Standard, 6.7.3.2.1, paragraph 18 20 [ISO/IEC 9899:20112024], says

As a special case, the last element of a structure with more than one named member may have an incomplete array type; this is called a flexible array member. In most situations, the flexible array member is ignored. In particular, the size of the structure is as if the flexible array member were omitted except that it may have more trailing padding than the omission would imply.

...

Bibliography

[ISO/IEC 9899:20112024]Subclause 6.7.3.2.1, "Structure and Union Specifiers"
[JTC1/SC22/WG14 N791]

Solving the Struct Hack Problem

...