Re: nested functions

Jatin Bhateja <Jatin_Bhateja@mentor.com>
8 Sep 2006 00:24:47 -0400

          From comp.compilers

Related articles
[3 earlier articles]
Re: nested functions torbenm@app-0.diku.dk (2006-08-30)
Re: nested functions tommy.thorn@gmail.com (Tommy Thorn) (2006-08-30)
Re: nested functions reji_thomas@symantec.com (2006-08-31)
Re: nested functions tommy.thorn@gmail.com (Tommy Thorn) (2006-08-31)
Re: nested functions marcov@stack.nl (Marco van de Voort) (2006-09-06)
Re: nested functions tommy.thorn@gmail.com (Tommy Thorn) (2006-09-06)
Re: nested functions Jatin_Bhateja@mentor.com (Jatin Bhateja) (2006-09-08)
Re: nested functions 148f3wg02@sneakemail.com (Karsten Nyblad) (2006-09-08)
Re: nested functions foobar@nowhere.void (Tommy Thorn) (2006-09-08)
Re: nested functions torbenm@app-3.diku.dk (2006-09-08)
Re: nested functions chris.dollin@hp.com (Chris Dollin) (2006-09-08)
| List of all articles for this month |

From: Jatin Bhateja <Jatin_Bhateja@mentor.com>
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
languages.


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.