Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!haven!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Question about using void * Message-ID: <14902@smoke.brl.mil> Date: 20 Jan 91 08:20:39 GMT References: <1991Jan18.225308.25139@Solbourne.COM> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 13 In article <1991Jan18.225308.25139@Solbourne.COM> imp@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.