On Thursday 24 September 2009 10:51, David Brown wrote: > As shown by the link you gave, zero-length arrays are only really valid > when they are the last element in a struct (they can be very useful there). I cannot read any restrictions on the use of zero-length arrays. It states "Zero-length arrays are allowed in GNU C" Period. And then an example is discussed about how it can be usefull. > The problem boils down to that C requires every declared object to have > a unique address. Theoretically, the compiler/linker could do this by > aliasing the zero-length array into the middle of something else that is > otherwise not addressed by the program. But in practice, it is done by > allocating at least 1 byte to zero-length data. Maybe true, but contraditory to my findings with gcc. When i keep it in the common (as is done automatically) gcc has no problems whatsoever with the zero length array, and indeed it address may overlap with other variables. It is up to the programmer i guess not to misuse this 'feature'.
My question was, why is there a difference in behaviour, and i hoped somebody could shine some light on this. But maybe it is like J"org says, just a bug. R. _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list