Article View: comp.std.c
Article #1818Re: qsort(), bsearch(), and rude comparison functions
From: Felix Lee
Date: Tue, 09 Oct 1990 21:17
Date: Tue, 09 Oct 1990 21:17
13 lines
1001 bytes
1001 bytes
>> While we're on the subject, what happens if the comparison function >> has side effects, benign or otherwise? > Nothing prohibits this. A pathological comparison function might shuffle the array being sorted each time it's called, in which case qsort() may never terminate. Is this prohibited? And I notice that 4.3 BSD's qsort uses static variables. Is the comparison function allowed to call qsort recursively? -- Felix Lee flee@cs.psu.edu
Technical Details
Message-ID:
<Fex+yrm2@cs.psu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!psuvax1!newsReferences:
<1990Oct6.013443.5364@twinsun.com> <1990Oct9.062455.21197@sq.sq.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!psuvax1!news From: flee@guardian.cs.psu.edu (Felix Lee) Newsgroups: comp.std.c Subject: Re: qsort(), bsearch(), and rude comparison functions Message-ID: <Fex+yrm2@cs.psu.edu> Date: 9 Oct 90 21:17:33 GMT References: <1990Oct6.013443.5364@twinsun.com> <1990Oct9.062455.21197@sq.sq.com> Sender: news@cs.psu.edu (Usenet) Organization: Penn State Computer Science Lines: 13 Nntp-Posting-Host: guardian.cs.psu.edu