This is the mail archive of the gcc-patches@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: [PATCH rs6000] (small C++ patch) Add intrinsics for the new vec_* specified by the C/C++ Language Extension for the CBEA


Mark Mitchell <mark@codesourcery.com> wrote on 09/30/2008 07:59:33 PM:

> Andrew Pinski wrote:
> 
> > I had to add some small support for C++ to support
> > COMPOUND_LITERAL_EXPR to say it is a lvalue.
> > cp/ChangeLog:
> > * tree.c (lvalue_p_1): COMPOUND_LITERAL_EXPR is also an lvalue.
> 
> The C++ change is OK if compound literals are lvalues in C.  I'm
> slightly surprised that they are, but if so, it makes sense to treat
> them the same way in C++.

I wonder why you are surprised they are lvalues for C, they were designed 
(as I understand it) to provide an anonymous variable.

Anyways here is the quote from the C99 standard which says they are 
lvalues, C99 6.5.2.5/5:
If the type name specifies an array of unknown size, the size is 
determined by the initializer list as specified in 6.7.8, and the type of 
the compound literal is that of the completed array type. Otherwise (when 
the type name specifies an object type), the type of the compound literal 
is that specified by the type name. In either case, the result is an 
lvalue.

Thanks,
Andrew Pinski


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