Re: [AD] Proposal: removal of zero-sized arrays

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> If that's the case, then does ISO C99 provide for static initialisation
> of such structures?

No, it doesn't.

> If it does not, then we have to ask does the ability to statically
> intialise such structures outweigh the required code changes.

Is that really the only solution in order for dat2c to work ?

> Are there any good references for the C99 standard? Can I browse it
> online anywhere, or is it payment-only?

Payment-only, I think. But a few drafts are floating around, for example:
http://www.vmunix.com/~gabor/c/draft.html

[6.5.2.1]
[#2] A structure or union shall not contain  a  member  with
       incomplete or function type, except that the last element of
       a structure may have incomplete array type.  Hence it  shall
       not contain an instance of itself (but may contain a pointer
       to an instance of itself).

[#15] As a special case, the last element of a structure may
       be  an  incomplete  array  type.   This is called a flexible
       array member, and the size of the structure shall  be  equal
       to  the offset of the last element of an otherwise identical
       structure that replaces the flexible array  member  with  an
       array  of  one  element.   When  an  lvalue  whose type is a
       structure with a flexible array member is used to access  an
       object,  it  behaves  as if that member were replaced by the
       longest array that would not make the structure larger  than
       the  object  being  accessed.   If  this array would have no
       elements, then it behaves as if it has one element, but  the
       behavior  is undefined if any attempt is made to access that
       element.


--
Eric Botcazou



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/