I\'ve read that qsort
is just a generic sort, with no promises about implementation. I don\'t know about how libraries vary from platform to plaform, but assumi
A qsort
implementation which can fail on large arrays is extremely broken. If you're really worried I'd go RTFS, but I suspect any half-decent implementation will either use an in-place sorting algorithm or use malloc
for temporary space and fall back to an in-place algorithm if malloc
fails.
I remember reading in this book: C Programming: A Modern Approach that the ANSI C specification doesn't define how to implement qsort.
And the book wrote that qsort
could in reality be a another kind of sort, merge sort, insertion sort and why not bubble sort :P
So, the qsort
implementation might not be recursive.
You know, the recursive part is logn deep. In 64 levels of recursion (which is ~64*4=~256 bytes of stack total) you can sort an array of size ~2^64, ie an array as large as you can address on a 64 bit cpu, which is 147573952589676412928 bytes for 64 bit integers. You can't even hold it in memory!
Worry about stuff that matters imo.