This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [using gcc book] compound literals
- From: Chris Devers <cdevers at pobox dot com>
- To: "Stephan T. Lavavej" <stl at caltech dot edu>
- Cc: GCC list <gcc at gcc dot gnu dot org>,"Joseph S. Myers" <jsm at polyomino dot org dot uk>,Nathan Sidwell <nathan at codesourcery dot com>
- Date: Sat, 23 Aug 2003 22:11:08 -0400 (EDT)
- Subject: Re: [using gcc book] compound literals
- References: <000001c369e3$72dbb580$3c9fd783@northwood>
- Reply-to: Chris Devers <cdevers at pobox dot com>
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