News for hackers. Stuff that matters.
Re:“Modern” C++ Lamentations by pjmlp on Friday December 28, 2018 @04:15PM (#18779472)
C does have a kind of lightweight generics since C11.
Re:“Modern” C++ Lamentations by fanf2 on Friday December 28, 2018 @05:52PM (#18780140)
Sadly C’s `_Generic` typecase mechanism does not do SFINAE: all the branches have to typecheck OK, regardless of which one is selected. This is OK for <tgmath.h> where the cases are different sizes of float, where there are few opportunities to get different failures in the different cases, but it makes _Generic hard to use for more template-like code.
Re:“Modern” C++ Lamentations by pjmlp on Friday December 28, 2018 @06:34PM (#18780371)
Given how hard SFINAE is to understand for typical developers, I consider it a good thing, actually.
Re:“Modern” C++ Lamentations by steveklabnik on Friday December 28, 2018 @05:09PM (#18779866)
Sure, but I’m not aware of them being used in any significant capacity, so I don’t think it’s particilary pertinent to this discussion.
Re:“Modern” C++ Lamentations by pjmlp on Friday December 28, 2018 @05:23PM (#18779960)
Ah, in that regard you are right, I guess.