Re:The Ugliest C Feature: tgmath.h
by The_rationalist on Sunday October 13, 2019 @07:47AM
(#21239887)
C11 obscoleted this with the _Generic macro
[ Parent
| on HN ]
And _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.
Re:The Ugliest C Feature: tgmath.h
by EdSchouten on Sunday October 13, 2019 @08:09AM
(#21239959)
C11 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/...
Far 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/