News for hackers. Stuff that matters.
Re:Anonymous functions in C by billsix on Saturday June 21, 2014 @09:39PM (#7926593)
As long as the stack frame is still active, the local variables are still alive and valid. So you could pass a local function as a parameter, but you could not return it. I think jwz called these "downward funargs".

GCC supports it http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html

Re:Anonymous functions in C by mtdewcmu on Saturday June 21, 2014 @09:50PM (#7926624)
GCC's nested functions are implemented with trampolines, so there will be a performance penalty. For the amount that you gain, they seem like a bad idea. Tying your code to GCC for the sake of a small amount of convenience is a bad idea.
Re:Anonymous functions in C by graphitemaster on Sunday June 22, 2014 @02:13AM (#7927054)
With things like PaX the trampoline method won't work, gcc now creates thunks, which are essentially heap allocated thunks of memory (hence the name) with PROT_EXEC.
Re:Anonymous functions in C by billsix on Sunday June 22, 2014 @12:11AM (#7926874)
The question to which I responded did not inquire about performance nor about portability

http://tirania.org/blog/archive/2011/Feb-17.html

Re:Anonymous functions in C by mtdewcmu on Sunday June 22, 2014 @06:24AM (#7927447)
My comment was about GCC's local functions. It wasn't really about your comment, so I regret if you took it personally.
Re:Anonymous functions in C by billsix on Wednesday June 25, 2014 @10:36PM (#7947872)
Thank you. Much respect, sorry if I was harsh.