[parisc-linux] 2.4.20-pa27 64bits smp problem!

John David Anglin dave@hiauly1.hia.nrc.ca
Wed, 26 Feb 2003 17:50:40 -0500 (EST)

> This is not a cast, it's a compound literal.

You of course are correct.  However, the GCC documentation says:

  ISO C99 supports compound literals.  A compound literal looks like
  a cast containing an initializer.  Its value is an object of the
  type specified in the cast, containing the elements specified in
  the initializer; it is an lvalue.  As an extension, GCC supports
  compound literals in C89 mode and in C++.

  Compound literals for scalar types and union types are is
  also allowed, but then the compound literal is equivalent
  to a cast.

  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.

So, the basic point is that the nesting of compound literals isn't
allowed because they are not a constant.  Cast operators in the
initializer portion of a compound literal can only convert arithmetic
types to arithmentic types, except as noted for the sizeof operator.

Unless you use the capability of compound literals to coerce to a
pointer to its first element, it doesn't appear that there is much
benefit in using compound literals for non-automatic data.

In Joel's case, the initializer only needs to contain constant
expressions and doesn't require a construction, even when the define
for RW_LOCK_UNLOCKED is done as a compound literal.

J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)