This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] manual: Correct guarantee about pointers compared by qsort()
- From: Florian Weimer <fweimer at redhat dot com>
- To: Anders Kaseorg <andersk at mit dot edu>, Andreas Schwab <schwab at suse dot de>
- Cc: Paul Eggert <eggert at cs dot ucla dot edu>, OndÅej BÃlka <neleai at seznam dot cz>, libc-alpha at sourceware dot org
- Date: Thu, 11 Dec 2014 11:25:10 +0100
- Subject: Re: [PATCH] manual: Correct guarantee about pointers compared by qsort()
- 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> <mvmmw6ur0d5 dot fsf at hawking dot suse dot de> <alpine dot DEB dot 2 dot 10 dot 1412110443010 dot 37899 at buzzword-bingo dot mit dot edu> <alpine dot DEB dot 2 dot 10 dot 1412110456190 dot 37899 at buzzword-bingo dot mit dot edu>
On 12/11/2014 10:57 AM, Anders Kaseorg wrote:
+Although the object addresses passed to the comparison function lie
+within the array, they need not correspond with the original locations
+of those objects, because the sorting algorithm may swap around
No comma before âbecauseâ.
+objects in the array before making some comparisons. The only way to
+perform a stable sort with @var{qsort} is to first augment the objects
+with a monotonic counter of some kind.
â@code{qsort}â instead of â@var{qsort}â.
Otherwise looks fine.
--
Florian Weimer / Red Hat Product Security