This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [using gcc book] compound literals


On Sat, 23 Aug 2003, Stephan T. Lavavej wrote:

> [Chris Devers]
> > The following passage appears in chapter five, section 5.20 (Compound
> > Literals).
>
> > I'm considering clarifying this paragraph as follows:
>
> I've looked over the two paragraphs several times and they look
> character-for-character identical to me.  Copy-and-paste error?

Nuts... yeah, probably a cut & paste think-o, the paragraphs are much
different.  Sorry about that.  Let's try again.

Original:

    As a GNU extension, GCC allows initialization of objects
    with static storage duration by compound literals (which is
    not possible in ISO C99, because the initializer is not a
    constant). It is handled as if the object was initialized
    only with the bracket enclosed list if compound literal's
    and object types match. The initializer list of the compound
    literal must be constant. If the object being initialized
    has array type of unknown size, the size is determined by
    compound literal size.

Edited:

    As a GNU extension, GCC allows initialization of objects
    with static storage duration by compound literals.  This is
    not possible in ISO C99, because the initializer is not a
    constant.  If the type of the compound literal matches that
    of the object, this behaves as if the object was initialized
    only with the brace enclosed list.  The initializer list
    of the compound literal must be constant.  If the object
    being initialized has array type of unknown size, the size
    is determined by compound literal size.


Now do they look different, does the revised one look cleaner, etc?

Thanks, and sorry again about the mis-paste :)




-- 
Chris Devers        cdevers@pobox.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]