On Tue, 22 Jan 2019, Martin Sebor wrote:

> PS In GCC 10, unless there is an important use case that escapes
> me, I think GCC should warn for zero-length non-member array
> objects, or perhaps even for internal struct members (those followed
> by another member).  Not to avoid these sorts of bugs but because
> they seem too dangerous to use safely.

I think one expected use case of zero-size objects is for e.g. a structure 
that is zero-size in some configurations of the code and non-zero-size on 
other configurations (but where it's most convenient to have the 
variables, struct members, etc. exist unconditionally).  It's quite 
possible that arrays of such objects may be constructed in such code.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to