I am rather new to C and I am reading this post: Killing Quicksort
and it says:
A note of caution for those playing along at home: the GNU C library qsort function is actually mergesort if the C library thinks the computer has enough free memory; to force quicksort, call the undeclared _quicksort function and compile with gcc -static.
Regarding the compiller option I use CMake and I have set the cmake flags to:
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -static")
but I am not sure how to call the undeclared _quicksort.
Does anyone have any experience with this?
Fix:
I have just declared the _quicksort function like @recycler suggested, in this manner:
void _quicksort(void *__base, size_t __nmemb, size_t __size,
__compar_fn_t __compar);
and it seems to behave like a quicksort now. I am a beginner in C, and for me this seems like magic, but anyway, I consider myself satisfied for now.