3 ms·
There's a far worse problem: that you effectively need to use it from preprocessor macros, which effectively prevents it from being used from being used in sane
by ori_b 2y ago
There's a far worse problem: that you effectively need to use it from preprocessor macros, which effectively prevents it from being used from being used in sane interfaces.
- flohofwoe 2y agoThe "interface" would directly expose the specialized and uniquely named functions. _Generic is just an inline helper to automatically select the right specialized function by a type. If C ABI compatibility is required, that's about the only way to do it (for better or worse). (FWIW I haven't found a compelling reason yet to use _Generic in my own C code)
- ori_b 2y agoI don't think there are very many compelling reasons to use it. It's a dead end. If I can use _Generic, I can get a cleaner interface by directly calling the right function, and skipping the macro mess.