|
|
|
|
|
by JonChesterfield
742 days ago
|
|
Interesting things in here. #define _(e) ({e;})
//!< isolate expression e in its own lexical scope and clamp it with ;
//!< note the outer parens, which is a very powerful c trick: they turn _(e) into a so called
//!< r-value, which basically means we can do x=_(e) for as long as e evaluates to or returns
//!< at least anything at all, i.e. not void. this macro is fundamental to k/simple implementation.
I didn't know that corner of C. Removing the () from the macro does change what you can pass as e, and assigning the result of a block does work as one would expect.edit: -Wpedantic on gcc will tell me ISO C doesn't like the construct but it still compiles it happily. Clang offers -Wgnu-statement-expression-from-macro-expansion So it looks likely that this is the GNU statement expression extension after all and not a part of C. Shame. |
|