[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Re: zero length array in nocommon
From: |
Ruud Vlaming |
Subject: |
Re: [avr-gcc-list] Re: zero length array in nocommon |
Date: |
Thu, 24 Sep 2009 11:45:26 +0200 |
User-agent: |
KMail/1.9.1 |
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.
- Re: [avr-gcc-list] zero length array in nocommon, (continued)
- Re: [avr-gcc-list] zero length array in nocommon, Joerg Wunsch, 2009/09/23
- Re: [avr-gcc-list] zero length array in nocommon, Ruud Vlaming, 2009/09/23
- Re: [avr-gcc-list] zero length array in nocommon, Dave Hylands, 2009/09/23
- Re: [avr-gcc-list] zero length array in nocommon, bleverett, 2009/09/23
- RE: [avr-gcc-list] zero length array in nocommon, Weddington, Eric, 2009/09/23
- Re: [avr-gcc-list] zero length array in nocommon, Ruud Vlaming, 2009/09/24
- RE: [avr-gcc-list] zero length array in nocommon, Weddington, Eric, 2009/09/24
- Re: [avr-gcc-list] zero length array in nocommon, Joerg Wunsch, 2009/09/24
- Re: [avr-gcc-list] zero length array in nocommon, Ruud Vlaming, 2009/09/24
- [avr-gcc-list] Re: zero length array in nocommon, David Brown, 2009/09/24
- Re: [avr-gcc-list] Re: zero length array in nocommon,
Ruud Vlaming <=
- [avr-gcc-list] Re: zero length array in nocommon, David Brown, 2009/09/24
- RE: [avr-gcc-list] Re: zero length array in nocommon, Weddington, Eric, 2009/09/24
- [avr-gcc-list] Re: zero length array in nocommon, David Brown, 2009/09/24
- RE: [avr-gcc-list] Re: zero length array in nocommon, Weddington, Eric, 2009/09/24
- [avr-gcc-list] Re: zero length array in nocommon, David Brown, 2009/09/24
- RE: [avr-gcc-list] Re: zero length array in nocommon, Weddington, Eric, 2009/09/24
- Re: [avr-gcc-list] Re: zero length array in nocommon, Joerg Wunsch, 2009/09/28
- RE: [avr-gcc-list] Re: zero length array in nocommon, Weddington, Eric, 2009/09/28
- Re: [avr-gcc-list] Re: zero length array in nocommon, Joerg Wunsch, 2009/09/24