🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2887

bsearch of empty array

#2887
From: Chris Dollin
Date: Wed, 15 May 1991 14:49
13 lines
990 bytes
If bsearch is called with $nmemb == 0$, is $base$ required to point to a
legitimate array, or can it be $NULL$ ?

[A library I know of hangs in this case; I'd like to know if my code is broken,
or if the library is.]

A similar question arises for $qsort$; if one $qsort$'s 0 elements, is the
value of the array pointer required to point to a proper array, or is it
allowed to be $NULL$?
--

Kers.       | "A foolish hobgoblin has the consistency of little minds".
Technical Details
Message-ID: <KERS.91May15154937@cdollin.hpl.hp.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!swrinde!ucsd!ucbvax!hplabs!otter.hpl.hp.com!hpltoad!cdollin!kers

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!swrinde!ucsd!ucbvax!hplabs!otter.hpl.hp.com!hpltoad!cdollin!kers
From: kers@hplb.hpl.hp.com (Chris Dollin)
Newsgroups: comp.std.c
Subject: bsearch of empty array
Message-ID: <KERS.91May15154937@cdollin.hpl.hp.com>
Date: 15 May 91 14:49:37 GMT
Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
Distribution: comp
Organization: Hewlett-Packard Laboratories, Bristol, UK.
Lines: 13
Nntp-Posting-Host: cdollin.hpl.hp.com