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]

[using gcc book] compound literals


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


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