%p and different pointer representations

Henry Spencer henry at utzoo.uucp
Fri Mar 3 03:38:01 AEST 1989


In article <928 at jhunix.HCF.JHU.EDU> ins_balb at jhunix.UUCP (Andy Matter) writes:
>#if sizeof (void *) > sizeof (void (*)())
>#define generic_ptr (void *)
>#else
>#define generic_ptr (void (*)())
>#endif
>Then use generic_ptr instead of void *...

Unfortunately, if I recall correctly (my Oct draft is out on loan), in
strict ANSI C it is illegal to convert function pointers into object
pointers and vice-versa.  Before you scream, consider that there are
architectures on which this is not a meaningful operation, and it is
almost always a highly machine-specific operation.  The ability to do
such conversions is mentioned under "common extensions" in the appendix.
-- 
The Earth is our mother;       |     Henry Spencer at U of Toronto Zoology
our nine months are up.        | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list