What does zero-length array mean at file scope?
Andrew Haley
aph@redhat.com
Fri May 29 10:17:00 GMT 2009
Joseph S. Myers wrote:
> On Sun, 24 May 2009, Andrew Haley wrote:
>
>> Of course we have to fix the assembler output. For [any] two declarations
>> a and b, &a != &b, even when a is a zero-length array. So, you have to
>> allocate at least one byte.
>
> I don't think this is necessarily part of the semantics for the GNU
> extensions of zero-length arrays and empty structures. Certainly when
> they are used in the middle of a structure they are not expected to take
> up any space (so their address may be the same as that of the next
> member).
I see. In that this breaks the semantics of C in a pretty fundamental
way this is pretty bad, but it's been in gcc for a long time.
Andrew.
More information about the Gcc
mailing list