avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] zero length array in nocommon


From: Ruud Vlaming
Subject: Re: [avr-gcc-list] zero length array in nocommon
Date: Wed, 23 Sep 2009 21:34:13 +0200
User-agent: KMail/1.9.1

On Wednesday 23 September 2009 21:14, Joerg Wunsch wrote:
> Ruud Vlaming <address@hidden> wrote:
> 
> > I noticed a strange behaviour when you place a zero length array in
> > 'nocommon'.
> 
> No idea why the behaviour changes, but as a note of warning: a
> zero-length array is not allowed by the C standard.  
Well, mayby not in ISO C, but certainly in GNU C:
  http://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
thus at least the gcc compiler should be able to handle it :-)

> No idea what you are trying to achieve here though.
Although the link gives an example how this could be usefull,
i found a different application. I configure my projects using
preprop defines, and if a don't need an array internally, the size
calculation simply produces a zero. That way no space is taken, 
and it is much easier than having if-defs around all arrays to see
if they accedently have size zero. But it seems it does not work
when they are not in the common space. 

This 'quirk' of gcc does not seem to be specifically avr related 
but probably we are the only one's left to care about the 
spoilled byte.

Ruud.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]