tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Local procedures


From: Antti-Juhani Kaijanaho
Subject: Re: [Tinycc-devel] Local procedures
Date: Tue, 11 Sep 2007 22:00:17 +0300
User-agent: Mutt/1.5.16 (2007-06-11)

On Tue, Sep 11, 2007 at 01:53:11PM -0500, Rob Landley wrote:
> Ok, back to the original question, I think you're asking for this:
> http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html
> 
> Which seems somewhere between an inline function and a macro.

It's not remotely like either.  (At least not more so than any C
function is.)

A nested function is a function that is local to another function, and
thus not in the global (or file) scope.  You implement them by keeping
track of the static chain (which function is my lexical parent) in
addition to the dynamic chain (which function called me).  Discussed in
e.g. the dragon book.

> I don't know of any existing programs that make use of this.  I'm 
> guessing you have an example? :)

No examples I know of, but the GNU coding conventions at least used to
recommend using them when portability to non-GNU compilers isn't an
issue.

-- 
Antti-Juhani Kaijanaho, Jyväskylä
http://antti-juhani.kaijanaho.fi/newblog/
http://www.flickr.com/photos/antti-juhani/




reply via email to

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