[prev in list] [next in list] [prev in thread] [next in thread]
List: asterisk-dev
Subject: Re: [asterisk-dev] gcc bug with zero-sized arrays
From: tony () softins ! clara ! co ! uk (Tony Mountifield)
Date: 2007-10-30 16:17:58
Message-ID: fg7lfm$uf5$1 () softins ! clara ! co ! uk
[Download RAW message or body]
In article <20071030061129.A88162@xorpc.icir.org>,
Luigi Rizzo <rizzo@icir.org> wrote:
> On Tue, Oct 30, 2007 at 12:51:56PM +0000, Tony Mountifield wrote:
> > Why would you want an element AFTER a zero-sized array? In the above
> > example, pre[0] would occupy the same storage as a.
> >
> > Surely the zero-sized array is supposed to be the final item in the struct,
> > so that the struct defines the fixed part and the array then identifies the
> > beginning of the variable-length part.
>
> asterisk's stringfields
>
> http://svn.digium.com/view/asterisk/trunk/include/asterisk/stringfields.h?view=log
>
> are defined using macros, and the wrapper code (macro
> AST_DECLARE_STRING_FIELDS() ) places a zero-size array as a marker
> before the first element, and a zero-size array as a marker after
> the last element. Macros then do pointer arithmetics using the
> start marker.
OK, I see what you mean now. The zero-sized arrays are effectively acting
just as labels.
Thanks!
Cheers
Tony
--
Tony Mountifield
Work: tony@softins.co.uk - http://www.softins.co.uk
Play: tony@mountifield.org - http://tony.mountifield.org
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic