Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: buehler@swift.template.com (John Buehler)
Subject: Re: Qsort problem in DEC C
Date: 03 Feb 1995 19:33:03 GMT	[thread overview]
Message-ID: <BUEHLER.95Feb3123303@swift.template.com> (raw)
In-Reply-To: lloyd-dr@nlvvax.llnl.egg.nv.doe.gov's message of Fri, 3 Feb 1995 17:05:43 GMT

David Lloyd writes:

>int compare (int *a, int *b)

[snip]

>  qsort(intarray, 10, sizeof(int), compare);

>Line  305:        qsort(intarray, 10, sizeof(int), compare);
>%CC-W-PTRMISMATCH, In this statement, the referenced type of the pointer value
> "compare" is "function (...) returning int", which is not compatible with
> "function (...) returning int".

  The warning is complaining about the parameter types on your
function.  A qsort callback should take 'const void *' according to
the function prototype in stdlib.h

  Apparently, you have to declare your function with those types on
your parameters and then cast them to 'int *'.  If anybody else has a
better workaround, I'd be interested in hearing it.

JB
-- 
John Buehler
Template Software 
13100 Worldgate Drive, Suite 340       
Herndon, VA 22070-4382
email:  buehler@template.com    voice: 703-318-1000	fax:703-318-7378

"Inertia is nature's default"


  parent reply	other threads:[~1995-02-03 19:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-02-03 17:05 Qsort problem in DEC C David Lloyd
1995-02-03 18:59 ` David Jones
1995-02-03 19:33 ` John Buehler [this message]
1995-02-06 23:14 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox