legality of assignment of function to a void *.

Henry Spencer henry at zoo.toronto.edu
Sat Nov 17 15:24:25 AEST 1990


In article <4e0cac89.20b6d at apollo.HP.COM> blodgett at apollo.HP.COM (Bruce Blodgett) writes:
>Was it really the intent of the ANSI C committee not to allow void
>pointers from holding uncasted function addresses (in either
>conforming or strictly conforming programs)?

Yes.  A void pointer, for compatibility reasons, is constrained to have
the same representation as a character pointer.  Pick a sufficiently
outre' machine, and function pointers may well be bizarre and complex
objects too large to fit in any reasonable data pointer.  A function
pointer is **not** (necessarily) the address of the function; functions
may not even have "addresses" in any simple sense, and calling a function
may require considerably more information than just where to find the code.
-- 
"I don't *want* to be normal!"         | Henry Spencer at U of Toronto Zoology
"Not to worry."                        |  henry at zoo.toronto.edu   utzoo!henry



More information about the Comp.std.c mailing list