3 ms·
C11 obscoleted this with the _Generic macro
by The_rationalist 7y ago
C11 obscoleted this with the _Generic macro
- EdSchouten 7y agoC11 doesn't obsolete it, right? It only permits it to be implemented portably. For the curious, here's an implementation of tgmath.h on top of _Generic: https://github.com/NuxiNL/cloudlibc/blob/master/src/include/tgmath.h https://github.com/NuxiNL/cloudlibc/blob/master/src/include/...
- kzrdude 7y agoFar from obsolete.. more is coming :) 'Add type generic interfaces for string functions to the C library, see N2068' has been mentioned as a possible C2x addition https://gustedt.wordpress.com/2018/11/12/c2x/ https://gustedt.wordpress.com/2018/11/12/c2x/
- fanf2 7y agoAnd _Generic is still somewhat ugly: it has the awkward property that all the branches must pass the type checker even if they are not used. This is mostly OK for numerical functions where you get some help from C’s implicit conversions making the checker more lenient, but if you try to apply _Generic in other contexts you soon encounter problems.