tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Local procedures


From: Zdenek Pavlas
Subject: Re: [Tinycc-devel] Local procedures
Date: Wed, 12 Sep 2007 14:10:33 +0200
User-agent: Thunderbird 1.5.0.12 (X11/20070530)

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]