Re:Let's Destroy C
by PatrickMDev on Thursday January 30, 2020 @03:28AM
(#22189817)
I found this one really fascinating, they're using both statement expression and nested functions. Their (reformatted) example of:
macro-expands to
So they have a statement-expression with just one statement in it - the value of that statement is the value of the whole statement-expression. And the one statement inside the statement expression is a declaration of a nested function named _. Statement-expressions decay their return types, so that function gets converted to a function pointer. And thus your "lambda" is a pointer to a GCC nested function.
[ Parent
| on HN ]
It's slightly different.
{ ret_type _ _body _; }
Notice the second underscore at the end? The compound statement contains a nested function definition followed by an expression statement which "returns" the function just defined. The function definition alone wouldn't work.