Hello,
According to
http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Zero-Length.html#Zero-Length
A zero-length array should have a length of 1 in c90.
But I tried
struct
{
char a[0];
} ZERO;
void main()
{
int a[0];
printf ("size = %d\n", sizeof(ZERO));
}
Compiled with gcc 4.7
~/work/install-x86/bin/gcc test.c -O2 -std=c90
size = 0
I noticed the following statement in GCC document.
"As a quirk of the original implementation of zero-length arrays,
sizeof evaluates to zero."
Does it mean GCC just does not conform to c90 in this respect?
Thanks,
Bingfeng Mei