News for hackers. Stuff that matters.
Re:Modern programming languages require generics by jhallenworld on Tuesday May 24, 2022 @12:04PM (#31493828)
I've written code just like this. Another option is to make the entire sort function a C macro. This would be feasible for something simple like quicksort.

But generics provide another benefit: in theory with them, the compiler should be able to determine that two high-level types are actually the same machine type, so in the above example, SORT_ELEMENT_TYPE int and long would not generate duplicate code on many machines.

There are no comments on this comment yet.