Article View: comp.std.c
Article #5898Prototype promotion?
From: David Keppel
Date: Fri, 14 Apr 1989 05:11
Date: Fri, 14 Apr 1989 05:11
38 lines
1287 bytes
1287 bytes
I declare a sort routine (like qsort(3)) as
extern void
sort (
void *array_to_sort,
int number_of_items_in_the_array,
int size_of_items_in_the_array,
int (*comparison_function) (void *, void*));
Then, I create a comparison function that takes not "void *" but
"void const *".
int
cmp_const (
void const *a,
void const *b)
{
...
}
My dpANS compiler (gcc) emits a warning:
a.c: In function main:
a.c:65: warning: argument passing between incompatible pointer types
Removing the two `const's from the comparison function causes the
compile to go smoothly.
Is this a bug or a feature? Of gcc or of dpANS? If this is a
feature, why is it a feature?
aTdHvAaNnKcSe
;-D on ( The man from ANSI ) Pardo
--
pardo@cs.washington.edu
{rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo
Technical Details
Message-ID:
<7867@june.cs.washington.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!labrea!rutgers!mit-eddie!uw-beaver!uw-june!pardoShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!labrea!rutgers!mit-eddie!uw-beaver!uw-june!pardo From: pardo@june.cs.washington.edu (David Keppel) Newsgroups: comp.std.c Subject: Prototype promotion? Message-ID: <7867@june.cs.washington.edu> Date: 14 Apr 89 05:11:20 GMT Reply-To: pardo@uw-june.UUCP (David Keppel) Organization: U of Washington, Computer Science, Seattle Lines: 38