4 ms·
The poster you are replying to didn't suggest hardcoding intcmp into qsort - just making it so the implmentation of qsort is available to the compiler when the
by TheNewAndy 6y ago
The poster you are replying to didn't suggest hardcoding intcmp into qsort - just making it so the implmentation of qsort is available to the compiler when the comparison function is known (i.e. just like with C++).
When this is done, the compiler can inline qsort, and replace the indirect function call with an inlined version of intcmp, and then things are equivalent.
- bluGill 6y agoOnly if inlining qsort is best. Sometimes it is sometimes it isn't, based on complex rules that I trust the compiler to know.