This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[using gcc book] compound literals
- From: Chris Devers <cdevers at pobox dot com>
- To: GCC list <gcc at gcc dot gnu dot org>
- Cc: "Joseph S. Myers" <jsm at polyomino dot org dot uk>,Nathan Sidwell <nathan at codesourcery dot com>
- Date: Sat, 23 Aug 2003 21:25:51 -0400 (EDT)
- Subject: [using gcc book] compound literals
- Reply-to: Chris Devers <cdevers at pobox dot com>
Hello
As noted in a message sent to this list a couple of weeks ago, I'm working
with FSF to proofread the upcoming edition of _Using GCC_.
The following passage appears in chapter five, section 5.20 (Compound
Literals).
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.
I'm considering clarifying this paragraph as follows:
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.
I think the second version is much more readable, but I want to be sure
that I haven't made any technical gaffes.
Could someone please look this over to see if anything looks amiss here?
Thank you very much.
--
Chris Devers cdevers@pobox.com
reusability, n.
A marketing priority overriding that of usability.
See also OBJECT ORIENTEERING.
-- from _The Computer Contradictionary_, Stan Kelly-Bootle, 1995