GCC's statement expression extension
Per Bothner
per@bothner.com
Sat Jul 29 10:28:00 GMT 2000
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/
More information about the Gcc
mailing list