casting to/from union types
brnstnd at stealth.acf.nyu.edu
brnstnd at stealth.acf.nyu.edu
Wed Jun 6 21:02:35 AEST 1990
In article <235 at taumet.COM> steve at 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
More information about the Comp.lang.c
mailing list