Register unions
Doug Gwyn
gwyn at smoke.BRL.MIL
Mon Oct 24 07:16:19 AEST 1988
>> In article <976 at l.cc.purdue.edu> cik at l.cc.purdue.edu (Herman Rubin) writes:
>> >One complaint that I have about the C compilers I have used is that they
>> >do not support register unions.
The point is, on many architectures not all basic data types could actually
share a register. Your original example was of an integer and a floating
type sharing a register, which doesn't work on any machines I'm aware of.
And obviously a union of large types would not fit into a register.
Simply permitting "register" to be crammed on the front of "union" would
do no good; the hardware would have to actually support the usage for
this to be worthwhile. If the hardware DOES support this, its C
implementation is allowed to use an actual register (so long as the
address is not taken). Good optimizing C compilers ignore the "register"
specifiers and do their own register allocation anyway.
More information about the Comp.lang.c
mailing list