[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: recent argp changes

From: Ben Pfaff
Subject: Re: recent argp changes
Date: Tue, 01 May 2007 20:21:41 -0700
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Paul Eggert <address@hidden> writes:

> Bruno Haible <address@hidden> writes:
>> you are now assuming an in-place sorting algorithm. If a libc were
>> to implement qsort by use of mergesort (and temporary storage), such
>> a sorting algorithm would pass you two pointers to hol_entrys in
>> different array.
> A minor quibble: the C standard (both C89 and C99) does not allow such
> an implementation for qsort; it requires that the arguments to the
> comparison function be bona fide pointers into the
> originally-specified array.

But even if this is true (it does seem to be implied by the
specification in the standard, now that I've re-read it), it
doesn't mean that comparison based on address will force a stable
sort.  I can, for example, imagine an implementation of qsort
that performs a random shuffle on the contents of the array
before doing a quicksort, to reduce the probability of
pathological behavior.
Ben Pfaff

reply via email to

[Prev in Thread] Current Thread [Next in Thread]