News for hackers. Stuff that matters.
Re:C23: A Slightly Better C by kevin_thibedeau on Sunday January 21, 2024 @02:43PM (#39082184)
C has generics as well. This permits the return type of generic functions to be preserved.
Re:C23: A Slightly Better C by jcranmer on Sunday January 21, 2024 @02:48PM (#39082247)
The only generic feature C has is the _Generic expression, which isn't a function, but closer to a switch(typeof(x)) expression.
Re:C23: A Slightly Better C by kevin_thibedeau on Sunday January 21, 2024 @02:51PM (#39082286)
_Generic can be used to merge a collection of functions.
Re:C23: A Slightly Better C by neutrono on Sunday January 21, 2024 @04:17PM (#39083171)
It should have been called _Overload or something similar, since it's not really a generic.
Re:C23: A Slightly Better C by CyberDildonics on Sunday January 21, 2024 @03:57PM (#39082976)
That's not the same as being able to write a data structure that takes any type.
Re:C23: A Slightly Better C by kevin_thibedeau on Sunday January 21, 2024 @04:17PM (#39083168)
It's still generic. You don't have to have feature parity with C++ to meet that bar.
Re:C23: A Slightly Better C by CyberDildonics on Sunday January 21, 2024 @05:29PM (#39083739)
That would be like calling function overloading generics.