This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Zero-length arrays
- To: rth at redhat dot com
- Subject: Re: Zero-length arrays
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Date: Thu, 4 Jan 01 13:16:50 EST
- Cc: gcc-patches at gcc dot gnu dot org
I would much prefer that this test be done in the front end
where we can give a hard error, and give decent context.
I suppose, but the issue is that a zero-length field is ambiguous. It could
actually *be* zero length or it could be extendable. This way, the ambiguity
is only if it's in the last field. Otherwise, it's treated as zero-length
and not extendable.
The other approach (which is probably cleaner but more work) adds a flag that
a front end can set to say this is an extendable field. Then we just test
that flag instead of looking for the type or a zero size.