5 ms·
I don't have stats, but I would think that the comparison function's definition typically is available at compile time. Also, if the compiler gets the qsort pr
by Someone 12y ago
I don't have stats, but I would think that the comparison function's definition typically is available at compile time.
Also, if the compiler gets the qsort prototype by including it from the system header <stdlib.h>, I think the compiler may assume that it is the standard qsort function. So, it could emit a custom qsort function that inlines the comparison function.
- mtdewcmu 12y ago>I don't have stats, but I would think that the comparison function's definition typically is available at compile time. The comparison function usually will be. The qsort function generally won't be available. >Also, if the compiler gets the qsort prototype by including it from the system header <stdlib.h>, I think the compiler may assume that it is the standard qsort function. So, it could emit a custom qsort function that inlines the comparison function. It could do something like that, but gcc doesn't (https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Other-Builtins.html#Other-Builtins https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Other-Builtins....). If you look at the kinds of API functions implemented as builtins, they are generally simple.