Earlier quoted context omitted.
19 years as a C/C++/ObjC developer, and this never occurred to me. And it works with C Blocks! typedef int IntegerProcessor(int); int executeTheFunctionPointer(IntegerProcessor* function) { return function(23); } int executeTheBlock(IntegerProcessor^ block) { return block(32); } int doubler(int a) { return a * 2; } int main(int argc, const char * argv[]) { IntegerProcessor* myFunctionPtr = &doubler; int a = executeTh…
This is so cool. Where can I find documentation on the following? IntegerProcessor^ myBlock = ^(int b) { return a * b; }; I wasn't aware C supported nested functions.
https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html
But it's not a proper closure, and it's not GC'd, so it's pretty useless.