From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexandre Oliva To: Mark Mitchell Cc: per@bothner.com, gcc@gcc.gnu.org Subject: Re: GCC's statement expression extension Date: Sat, 29 Jul 2000 11:48:00 -0000 Message-id: References: <3981F647.2FBFFD19@apple.com> <20000728224030N.mitchell@codesourcery.com> <20000729104258V.mitchell@codesourcery.com> X-SW-Source: 2000-07/msg00975.html On Jul 29, 2000, Mark Mitchell wrote: > X x; > X f(); > x = ({ f(); }); > Oops. The return value of f() got destroyed before we got a chance to > copy it. I see. We'd have to have copied it to some temporary that would hold the result of the statement expression before calling its destructor. But we'd have to special-case this copy to only be done for the last statement of a statement-expression. Too bad. Maybe the way to go is to require statement expressions to contain explicit `return' statements, at least in C++. This would at least make it easier to support them in C++. Is `return' currently usable within statement expressions? -- Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/ Red Hat GCC Developer aoliva@{cygnus.com, redhat.com} CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org} Free Software Evangelist *Please* write to mailing lists, not to me