Article View: comp.std.c
Article #4997Re: Restrictions on qsort compare function?
From: Peter Curran
Date: Mon, 08 Apr 1996 17:14
Date: Mon, 08 Apr 1996 17:14
30 lines
2351 bytes
2351 bytes
On Mon, 08 Apr 96 13:56:53 GMT in article <828971813snz@genesis.demon.co.uk>
Lawrence Kirby <fred@genesis.demon.co.uk> (Lawrence Kirby) wrote:
>>IMHO, qsort() is required to return an array that is sorted according to the
>>criteria implied by the comparison function. That is, at the point where qsort
>>returns, the array must match the order implied by the comparison function.
The comparison function I postulated *is* consistent, at any instant in time.
(Just to be clear - another correspondent suggested my original posting may not
have said quite what I intended. The comparison function I suggested., or
intended, calculates as result by comparison of the values pointed at by the
parameters, in a way we can all agree is acceptable. However, it then calls
time(), and if the result it odd it negates the result before returning it. In
a conventional implementation of time(), it reverses the order every second, but
defines a consistent order at any given time.)
>The critical word is 'sorted'. I suggest you read section 5 (i.e. the
>first section of chapter 5) in Knuth Vol 3 to get a reasonable idea of what
>a sort is.
I can assure you that I read Knuth cover to cover, within a few weeks of its
first publication. I really don't think this kind of insult is necessary here.
There isn't much point in continuing this. We will have to agree to disagree.
I understand how you are reaching the conclusions you are reaching (and I agree
it should be possible to reach them). However I think that you are stretching
the text of the standard beyond the breaking point to get there.
--
Peter Curran pcurran@inforamp.net
Technical Details
Message-ID:
<4kbl1l$74r@sam.inforamp.net>Path:
arc1-ca.pugleaf.net!inforamp.net!usenetReferences:
<4iokop$h4p@lyra.csx.cam.ac.uk> <4iqjar$2m9@usenet.pa.dec.com> <4jgltp$f9l@lyra.csx.cam.ac.uk> <828644274snz@genesis.demon.co.uk> <4k28t4$2g0@sam.inforamp.net> <828726582snz@genesis.demon.co.uk> <4k69bf$ehg@sam.inforamp.net> <828971813snz@genesis.demon.co.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!inforamp.net!usenet From: pcurran@inforamp.net (Peter Curran) Newsgroups: comp.std.c Subject: Re: Restrictions on qsort compare function? Date: Mon, 08 Apr 1996 17:14:13 GMT Organization: PSC Enterprises Message-ID: <4kbl1l$74r@sam.inforamp.net> References: <4iokop$h4p@lyra.csx.cam.ac.uk> <4iqjar$2m9@usenet.pa.dec.com> <4jgltp$f9l@lyra.csx.cam.ac.uk> <828644274snz@genesis.demon.co.uk> <4k28t4$2g0@sam.inforamp.net> <828726582snz@genesis.demon.co.uk> <4k69bf$ehg@sam.inforamp.net> <828971813snz@genesis.demon.co.uk> Reply-To: pcurran@inforamp.net NNTP-Posting-Host: ts53-08.tor.istar.ca X-Newsreader: Forte Free Agent 1.0.82