Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!novavax!twwells!bill From: bill@twwells.uucp (T. William Wells) Newsgroups: comp.lang.c Subject: Re: %p and different pointer representations Message-ID: <746@twwells.uucp> Date: 4 Mar 89 01:40:57 GMT References: <9382@bloom-beacon.MIT.EDU> <1089@vicorp.UUCP> <234@mstan.Morgan.COM> <16112@mimsy.UUCP> <9453@bloom-beacon.MIT.EDU> <1890@dataio.Data-IO.COM> <928@jhunix.HCF.JHU.EDU> <9765@smoke.BRL.MIL> Reply-To: bill@twwells.UUCP (T. William Wells) Organization: None, Ft. Lauderdale Lines: 22 Summary: Expires: Sender: Followup-To: Distribution: Keywords: In article <9765@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: : >Also, how's this for a solution: : >#if sizeof (void *) > sizeof (void (*)()) : >#define generic_ptr (void *) : >#else : >#define generic_ptr (void (*)()) : >#endif : >Then use generic_ptr instead of void *, and any pointer type : >(including pointers to functions) will fit (as long as you remember to : >cast everything you assign). : : Won't work. There is no guarantee that an object pointer can be : converted to a function pointer or vice-versa. Also, the sizeofs don't work in #ifs. Not according to the dpANS, nor in many existing compilers. --- Bill { uunet | novavax } !twwells!bill (BTW, I'm going to be looking for a new job sometime in the next few months. If you know of a good one, do send me e-mail.)