This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Suggestion re GCC's statement expression extension
- To: gcc at gcc dot gnu dot org
- Subject: Suggestion re GCC's statement expression extension
- From: suckfish at ihug dot co dot nz
- Date: Sat, 5 Aug 2000 14:42:32 +1200 (NZST)
Hi,
From the recent discussion of statement expressions, it seems that the
most significant use of these is to introduce named temporary
variables within an expression.
Why don't we introduce an explicit construct for this, something like:
__let__ int x = foo() __in__ (x * x).
which would be an expression that assigns foo() to x, and then yields
the value (x*x). The name x should only be visible within the
__let__...__in__... expression, but the lifetime of the variable
should be determined just like the lifetime of any other (unnamed)
temporary introduced in an expression.
(Perhaps a more C-like syntax could be used, though.)
Ralph.