Prototype promotion?

David Keppel pardo at june.cs.washington.edu
Fri Apr 14 15:11:20 AEST 1989


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 at cs.washington.edu
    {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo



More information about the Comp.std.c mailing list