Question about using void *
Doug Gwyn
gwyn at smoke.brl.mil
Sun Jan 20 19:20:39 AEST 1991
In article <1991Jan18.225308.25139 at Solbourne.COM> imp at Solbourne.COM (Warner Losh) writes:
>My question is: Is this portable? Can I stuff an integer into a
>pointer and expect to get it back out again?
Any use of void* is not going to work on some pre-ANSI compilers.
It is not generally safe to try to convert an arbitary integral
value to a pointer. While the implementation much provide SOME
integral type capable of holding a (properly converted) object
pointer, the converse is not required. (Only for values
obtained by starting with a valid pointer.)
This is an ideal place to use a union type.
More information about the Comp.lang.c
mailing list