Re: nested functions

Jatin Bhateja <>
8 Sep 2006 00:24:47 -0400

          From comp.compilers

Related articles
[3 earlier articles]
Re: nested functions (2006-08-30)
Re: nested functions (Tommy Thorn) (2006-08-30)
Re: nested functions (2006-08-31)
Re: nested functions (Tommy Thorn) (2006-08-31)
Re: nested functions (Marco van de Voort) (2006-09-06)
Re: nested functions (Tommy Thorn) (2006-09-06)
Re: nested functions (Jatin Bhateja) (2006-09-08)
Re: nested functions (Karsten Nyblad) (2006-09-08)
Re: nested functions foobar@nowhere.void (Tommy Thorn) (2006-09-08)
Re: nested functions (2006-09-08)
Re: nested functions (Chris Dollin) (2006-09-08)
| List of all articles for this month |

From: Jatin Bhateja <>
Newsgroups: comp.compilers
Date: 8 Sep 2006 00:24:47 -0400
Organization: Compilers Central
References: 06-08-140
Keywords: code
Posted-Date: 08 Sep 2006 00:24:47 EDT

  >My next doubt is regarding the nested function support from GCC using
  >trampolines. I could see that in case of function pointers of nested
  >functions GCC was generating the code on the stack to move the frame
  >pointer of the function in which the nested function is nested to ECX
  >and then to do a jump to the nested function.

  >Whether GCCs support for nested functions is similar to nested function
  >support in functional languages like haskell/scheme and do trampolines
  >provide any advantage other than access time.?

According to me GCC nested functions are not same as nested functions
in functional languages as these languages are dynamically scoped
languages and in them the order in which locals are searched is from
inner to outermost function in enclosing order in run time stack. This
could be implimented by using either Displays or by following the
static link in activations records at run time.

On the other had C is statically scoped language (as per C standard) and
thus nested function extension of GCC is different form usual functional

Thanks and Regards
Jatin Bhateja
Mentor Graphics, Noida.

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.