Re:The Cost of a Closure in C
by nutjob2 on Thursday December 11, 2025 @07:53AM
(#46230778)
I really did, my comment is specific to C.
[ Parent
| on HN ]
Re:The Cost of a Closure in C
by LegionMammal978 on Thursday December 11, 2025 @10:44AM
(#46232788)
The only reason that GCC needs executable trampolines is for the program to be able to create an ordinary function pointer and have all the captured data come along with it. The proposal is to reuse the syntax of nested functions, but change the semantics so that they are no longer callable via ordinary function pointers, but rather "fat pointers" that reference the captured data alongside the raw function address. This is similar to the method used by C++ and does not need trampolines.
Meaning something that generates code similar to what I have in this comment?
Re:The Cost of a Closure in C
by sirwhinesalot on Friday December 12, 2025 @10:10AM
(#46244835)
Yeah something like that, though built-in to the compiler.