delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/21/08:40:17

From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: qsort() bug? Or invalid usage???
Date: Fri, 21 Jan 2000 11:19:32 +0200
Organization: NetVision Israel
Lines: 15
Message-ID: <388824A4.7E8CA268@is.elta.co.il>
References: <R0Gh4.2371$Ll5 DOT 3502 AT news2 DOT randori DOT com> <867gpd$k0u$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <388758A7 DOT 1B64BDF9 AT cyberoptics DOT com>
NNTP-Posting-Host: ras1-p22.rvt.netvision.net.il
Mime-Version: 1.0
X-Trace: news.netvision.net.il 948446366 24979 62.0.172.24 (21 Jan 2000 09:19:26 GMT)
X-Complaints-To: abuse AT netvision DOT net DOT il
NNTP-Posting-Date: 21 Jan 2000 09:19:26 GMT
X-Mailer: Mozilla 4.7 [en] (Win98; I)
X-Accept-Language: en,ru,hebrew
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Eric Rudd wrote:
> 
> Yes, and equal objects must return 0.  The last time I checked, DJGPP's qsort
> implementation sometimes attempts to dereference beyond the ends of the array
> if the comparison function returns inconsistent results.

When was that ``last time''?  The implementation of `gsort' in the DJGPP
library was changed between v2.01 and v2.02.

> I don't think that a
> good implementation should do this, but I can find nothing in the ANSI standard
> that would prohibit such behavior.

AFAIK, ANSI C explicitly allows to access an array one element before the
first one, provided that you don't write there.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019