3 ms·
C has generic selection via _Generic. You just have to write your generic function as a macro which uses that in its expansion. It has limitations. It's powerfu
by kazinator 2y ago
C has generic selection via _Generic. You just have to write your generic function as a macro which uses that in its expansion. It has limitations. It's powerful enough though that for example in the current draft C, I believe, functions like strchr are now overloaded such that if the argument is const char *, you get the const-qualified return type, otherwise plain. There's a header of type generic math as well.