ANSI C and function prototypes

Henry Spencer henry at utzoo.UUCP
Fri Feb 7 07:25:30 AEST 1986


>   ...Is there any way to prototype the second argument as a pointer to
> a function returning 'anything'?  I realize if I prototype the second
> argument as a 'void *pointer', any pointer will be properly converted, 
> but this defeats my purpose of checking to make sure that the second
> argument is really a function pointer...

Prototyping it as "void *" is wrong too, and a strict ANSI-compliant
compiler will reject use of it as illegal.  "void *" is a generic *data*
pointer, and function pointers are not data pointers.  The ANSI drafts
say that mixing function pointers and data pointers is illegal, period,
although it is listed in the relevant appendix as a "common extension".
It certainly is a potential portability problem even if the compiler
permits it.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list