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


Mark Mitchell <mark@codesourcery.com> writes:

> There are certainly things that one can do with statement-expressions
> that one cannot do without them.  However, I don't believe this
> justifies keeping them indefinitely, given that their many
> limitations.

One use I've found for statement-expressions: Suppose you want to
implement an expression-oriented language, i.e. a language where there
is no real distinction between expressions and statements, which
category includes all functional languages as well as other languages
such as Algol68.  A classic strategy is to compile into C.  It is
very easy to compile incoming abstract syntax tree structure into C -
if you can use statements expressions.  It becomes a trivial mapping.
If you can't use statement expressions, it becomes much messier.

If your language has objects or non-trivial data-types, it is
nice to be able to use C++ rather than C as your target language.

We should keep statement expressions in both C and C++.
-- 
	--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]