%p and different pointer representations

Karl Heuer karl at haddock.ima.isc.com
Thu Mar 2 05:14:51 AEST 1989


In article <597 at jhereg.Jhereg.MN.ORG> mark at jhereg.MN.ORG (Mark H. Colburn) writes:
>What it means, is that there is no portable way to pass an arbitrary pointer
>to a function or store one in a data structure.

Any function-pointer object may be cast to any other function-pointer type and
back without change; hence any such type (e.g. `void (*)(void)') may be used
as a generic function-pointer type.  Therefore, a completely generic pointer
type (to function or data) is `union {void (*)(void); void *}', though I can't
think of any practical use for such a thing.  (The (nonportable) uses I can
come up with are better served by a cast rather than a union.)

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list