Well, this code is a small fragment of a bigger program. When the program crashed I had to isolate the root cause of the wrong behavior. I cannot move all nested functions because first it can cause name clashes and second the nested functions indeed use lexicals of the containing functions in most cases.
-- Regis Cridlig cridlig@gmail.com
Le 5 avr. 08 à 06:08, Waldek Hebisch hebisch@math.uni.wroc.pl a écrit :
Regis Cridlig wrote:
If you take a closer look at the Pascal source code below there is no need for a trampoline or stub code since the inner function E does not use any variable or parameter in the lexical scope of the containing function Q.
Hence, why does gpc generate a trampoline in this case? how to prevent it?
Well, do not used nested function as a procedural parameter -- if you do not need access to variables or parameters in Q you can move E outside. The assumption when allowing nested functions as functional parameter was that they are used to access lexicals in the containing function.
-- Waldek Hebisch hebisch@math.uni.wroc.pl