[wish] Flexible array members in unions
Thu May 11 21:43:49 GMT 2023
On Thu, 11 May 2023, Kees Cook via Gcc wrote:
> Why are zero-sized objects missing in Standard C? Or, perhaps, the better
> question is: what's needed to support the idea of a zero-sized object?
Zero-sized objects break the principle that different objects have
different addresses, and the principle of being able to subtract pointers
to different elements of an array. There would also be serious C++
compatibility concerns, since C++ allows a struct with no members but it
has nonzero size, unlike the GNU C extension where a struct with no
members has size zero.
Joseph S. Myers
More information about the Gcc