Bug in 4.2BSD C compiler...

Henry Spencer henry at utzoo.UUCP
Fri May 10 04:08:41 AEST 1985


> ...  The question arises on the basis of K&R
> pp 114-115, which would seem to indicate that my declaration is acceptable
> on the grounds that pointers to integers and pointers to functions returning
> integers are supposed to be equationally indistinguishable.

I don't know how you got this idea; nothing of the sort appears on pages
114-115 of my copy of K&R.  The only thing there that is even vaguely along
these lines is the observation that function names don't need an & since
the compiler knows they are functions.  They still remain pointers to
functions, not pointers to integers.

Compilers that accept either of your versions are being sloppy.  There
are many sloppy C compilers in the world.  Do not mistake this for
sloppiness in the language.  "int (*foo[])() = {...}" remains the right
way to declare an array of pointers to functions returning int.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list