Antti-Juhani Kaijanaho wrote:
On Wed, Sep 12, 2007 at 12:54:16PM +0200, Zdenek Pavlas wrote:
Even if you really need a trampoline, you don't need a fancy compiler for
that. It's easy to implement (at least on i386) using the existing support
for attribute(regparm). Real closures in C- way more fun than gcc's nested
functions, which are quite limited and (rightfully, IMO) seldom used.
Except that what your example program does is not a real closure.
Right. It was just an example how to implement a code semantically
equivalent to nested functions. Had the second argument to closure()
been not a stack reference but a literal or a malloc()ed struct, 'fun'
would become a real closure, a first-class object that could be
return'ed, stored somewhere, etc.
You *do* need compiler support for them.
Syntax sugar, perhaps?
--
Zdenek Pavlas
_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel