Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!apple!bionet!agate!ucbvax!hplabs!hpda!hpcupt1!hpisod1!renglish From: renglish@hpisod1.HP.COM (Robert English) Newsgroups: comp.lang.c Subject: Re: Re: Register unions Message-ID: <10130003@hpisod1.HP.COM> Date: 25 Oct 88 20:29:47 GMT References: <983@l.cc.purdue.edu> Organization: Hewlett Packard, Cupertino Lines: 21 > / gwyn@smoke.BRL.MIL (Doug Gwyn ) / 2:16 pm Oct 23, 1988 / > 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. Even if the hardware could not support a register union of incompatible data types, the information would be valuable to an optimizer. "Register," in addition to expressing a storage preference, informs the compiler that the variable is non-addressable, and that the compiler needn't worry about the contents changing. --bob--