Prev: function to plot coordinates
Next: Object oriented c++?
From: Neville Dempsey on 17 Jul 2010 06:35 re: gcc There is an issue when taking the address of a nested function. Somehow the stack frame of the parent function must also be stored somewhere.... Hence: http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html > GCC implements taking the address of a nested function using a technique called trampolines. This technique was described in Lexical Closures for C++ (Thomas M. Breuel, USENIX C++ Conference Proceedings, October 17-21, 1988). http://en.wikipedia.org/wiki/Trampoline_%28computers%29 > In the GCC compiler, trampoline refers to a technique for implementing pointers to nested functions. The trampoline is a small piece of code which is constructed on the fly on the stack when the address of a nested function is taken. The trampoline sets up the static link pointer, which allows the nested function to access local variables of the enclosing functions. The function pointer is then simply the address of the trampoline. This avoids having to use "fat" function pointers for nested functions which carry both the code address and the static link. I suspect that algol68toc (A68RS) uses "fat" function pointers instead of "Trampolines" because (IIRC) algol68toc generates standard "C" code where no gcc extensions are required. NevilleDNZ -- To download Linux's Algol68 Compiler, Interpreter & Runtime: * http://sourceforge.net/projects/algol68 |