Mail Archives: djgpp/2001/06/29/11:15:04
invalid AT erehwon DOT invalid (Graaagh the Mighty) wrote in message news:<3b3be472 DOT 251871236 AT news DOT primus DOT ca>...
> >Just because it's called qsort() by no means implies that the
> >implementation is QuickSort. In the case of DJGPP, it isn't.
>
> Oops, I forgot: just because it's called libc by no means implies that
> it's ANSI C. :P
ANSI C imposes no such requirement. The algorithm does not matter.
What matters is that the implementation behaves in the following way:
(quoting from http://www.dinkumware.com/htm_cl/stdlib.html#qsort)
"The function sorts, in place, an array consisting of nelem elements,
each of size bytes, beginning with the element whose address is base.
It calls the comparison function whose address is cmp to compare pairs
of elements. The comparison function must return a negative value if
e1 is less than e2, zero if the two are equal, or a positive value if
e1 is greater than e2. Two array elements that are equal can appear in
the sorted array in either order."
Sinan.
--
A. Sinan Unur
http://www.unur.com/
- Raw text -