This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC's statement expression extension
Mark Mitchell <mark@codesourcery.com> writes:
> statement expressions ... don't have documented semantics in C++
> (for example, when does a temporary created in the statement
> expression go away?),
Intuitively, it seems to me there is only one rational answer:
when you exit the (block of) the statmenet expression.
This answer appears obvious if you have Scheme experience, since in
Scheme all statements are expressions (though they sometimes return an
unspecified value), and blocks (let-expressions) are syntatic sugar of
a call to a lambda-expression. Think of a statement expression as
short-hand for an inline function that got inlined.
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/