Re: [PHP4BETA] rsort() bug?
| From: | Alfred Perlstein | Date: | Wed, 10 May 2000 22:41:19 +0000 |
| Subject: | Re: [PHP4BETA] rsort() bug? | ||
| References: | 1 2 3 4 5 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-14796@lists.php.net to get a copy of this message | ||
* Andrei Zmievski <andrei@ispi.net> [000510 15:00] wrote:
> On Wed, 10 May 2000, Alfred Perlstein wrote:
> > Just roll/import your own version of qsort that is ok with a
> > non-deterministic comparison function, they exist no?
> >
> > I think FreeBSD's is ok with it.
>
> Well, that's why we got mergesort() from FreeBSD - to avoid qsort()
> problems. But for some reason mergesort() is failing here...
I think FreeBSD's is only ok when you incorrectly return that
like values differ. Sorry, it's been a while since I got kicked
by the qsort thing under Solaris and had to debug it.
I think my second choice would be somewhat helpful, using a global
so that you can tell the comparison function just how to behave.
something like:
enum sortmethod {
SORT_NUMBER,
SORT_STRING,
SORT_MIXED
}
which you would set before entering the sort function qsort
which would tell it how to compare things.
--
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."