Function-types: compatability, and typedefs

Doug Gwyn gwyn at smoke.BRL.MIL
Sun Sep 3 08:57:08 AEST 1989


In article <9488 at venera.isi.edu> lmiller at venera.isi.edu.UUCP (Larry Miller) writes:
>	This is my interpretation also, but GNU, in particular, disallows
>	this.  Since my copy of the draft standard is very old (Nov, 1985),
>	could someone refer to a specific section in the latest draft?

The "same representation" requirements were added approximately a year ago.
It is possible that the compiler you're using was based on an older draft
proposed standard.

>	void qsort(void *base, size_t n, size_t width,
>			int (*f)(const void *, const void *));
>	Can be passed a char ** as the first element WITHOUT specifically
>	casting to void * (as long as the prototype is in scope).

Yes, because in the presence of a prototype the arguments are converted
to the declared types as though by assignment, and these pointer types
happen to be assignment-compatible (section 3.3.16).



More information about the Comp.lang.c mailing list