3 ms·
I don't like the approach here, and the fact that it's gcc-specific. Many years ago I wrote a small macro library for discriminated unions/sums which I think is
by naasking 10y ago
I don't like the approach here, and the fact that it's gcc-specific. Many years ago I wrote a small macro library for discriminated unions/sums which I think is much cleaner and looks like actual C [1].
With some fancier variable macros + C11, you can even make closures in C viable [2].
[1] https://github.com/naasking/libsum https://github.com/naasking/libsum
[2] Incomplete, but both curried and uncurried closures are possible: https://github.com/naasking/cclosures https://github.com/naasking/cclosures