Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!usc!rutgers!cmcl2!stealth.acf.nyu.edu!brnstnd From: brnstnd@stealth.acf.nyu.edu Newsgroups: comp.lang.c Subject: Re: casting to/from union types Message-ID: <17366:Jun611:02:3590@stealth.acf.nyu.edu> Date: 6 Jun 90 11:02:35 GMT References: <523@cpsolv.CPS.COM> <235@taumet.COM> Reply-To: brnstnd@stealth.acf.nyu.edu (Dan Bernstein) Distribution: usa Organization: IR Lines: 12 In article <235@taumet.COM> steve@taumet.UUCP (Stephen Clamage) writes: [ on casting from a component type to the union type ] > It seems unnecessary to invent an extension to C to accomodate what must > be a very unusual operation. There's at least one ``usual'' example of essentially the same problem, namely in BSD Internet socket programming: struct in_addr has just a single component, namely u_long s_addr. In the one case where I ever used one value as both those types, I kept just the struct around, and referred to its s_addr component when necessary. This always works. ---Dan