Document: WG14 N1189

Date: 2006-09-09

Author: Willem Wakker

Question:Is it allowed to have a structure with a flexible array member as last member of another structure (making the flexible array again the last element of that other structure).

The C99 constraint section in 6.7.2.1 para 2 is pretty clear:

... such a structure (...) shall not be a member of a structure or an element of an array.
So, the answer is NO. However, the Rationale (sect 6.7.2.1 line 20) says:
Similarly, structures containing flexible arrays can’t occur in the middle of other structures or in arrays.
The words in the middle seem to allow for the last element case.

In order to bring the Rationale in line with C99, the words in the middle should be removed.

Note that implementations (such as GCC) allow structures with flexible array members as last element of other structures.