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]

Re: GCC's statement expression extension


Alexandre Oliva <aoliva@redhat.com> writes:

> Yep.  But in the case of statement expressions, there isn't just one
> statement containing the expression:
> 
>   ({ foo(); bar(); });
> 
> Why is it any ``more correct'' to destruct the temporary returned by
> foo() in the statement `foo();' that it is to destruct it at the end
> of the full enclosing statement?

You do the same as you would do in this case:

        inline T __tmp1() { foo(); return bar(); }
        ... __tmp1() ...

where T is the type of bar().  At least that is my proposal.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

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