* Tim Rühsen: > But I still wonder why > > - nested functions need an executable stack (why does the code have to > be run on the stack ?)
The static chain pointer needs to be passed to the nest function, but most ABIs only have a code pointer. So a trampoline is written to the stack which sets up the static chain (in a hidden function argument) and calls the implementation. The address of the trampoline is used as the code pointer for the nested function. > - there are no efforts to standardize either nested functions or blocks > (clang has 'blocks' instead of nested functions) or both. (There is a > C22 panel, but I couldn't find anything useful on their task list.) You can simply use C++. C++11 and later have std::function and lambdas. The standardization of lambdas for C has been abandoned, as far as I know. Thanks, Florian