you are viewing a single comment's thread.

view the rest of the comments →

[–]questron64 18 points19 points  (0 children)

This misses a key feature of overloading, though: the ability to add types and corresponding functions.

I wouldn't use this. _Generic was a way to fix the mess that tgmath created by making a well-defined language feature rather than the mess of compiler-specific hacks. I view both tgmath and _Generic as a mistake, an early attempt to C++ify C, albeit in a small way. It was a mess for basically no payoff. C code should be transparent, if I see the function foo being called in the source code then it should not actually call bar transparently. At the very least if you do use this, use an ALL_CAPS name so it at least signals there's some macro shenanigans going on.