This is the mail archive of the
mailing list for the glibc project.
Re: [COMMITED][v2] manual: Remove incorrect claim that qsort() can be stabilized
- From: Andreas Schwab <schwab at suse dot de>
- To: Paul Eggert <eggert at cs dot ucla dot edu>
- Cc: OndÅej BÃlka <neleai at seznam dot cz>, Anders Kaseorg <andersk at MIT dot EDU>, Florian Weimer <fweimer at redhat dot com>, libc-alpha at sourceware dot org
- Date: Thu, 11 Dec 2014 10:39:50 +0100
- Subject: Re: [COMMITED][v2] manual: Remove incorrect claim that qsort() can be stabilized
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 02 dot 1407022115210 dot 28890 at all-night-tool dot MIT dot EDU> <20141210154909 dot GA31968 at domone> <54892DF9 dot 8080007 at cs dot ucla dot edu>
Paul Eggert <firstname.lastname@example.org> writes:
> The last clause is incorrect. C11 and POSIX both require that the
> addresses passed to the comparison function must point to elements of the
> original array, and glibc qsort conforms to the standards here.
That is only true for bsearch:
"The comparison function pointed to by compar is called with two
arguments that point to the key object and to an array element, in
The description for qsort does not say that:
"The contents of the array are sorted into ascending order according
to a comparison function pointed to by compar, which is called with
two arguments that point to the objects being compared."
Andreas Schwab, SUSE Labs, email@example.com
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."