Post #1907322
2026-05-02 16:45 UTC
@thephd aw hell yea
in addition to the primary use, im super excited for an alternative usage it enables which ive wanted for many years:
#define let_in(TMP, VAL, EXP) _Generic((VAL) \
, typeof (VAL) TMP: (EXP))
// temporary variables within expressions!
int x = let_in(tmp, side_effects(), tmp > 10 ? tmp : tmp - 1);
finally you can write a correct max macro lol
(what i think of as "lightweight lambdas" - all i want is a name binding, don't need the complexity of anything bigger)
Replies (1)
-
@uecker@mastodon.social 2026-05-02 16:49
@erisceleste @thephd hehe, that was what I was thinking about when proposing it on the reflector. But, can't you use the default branch?