Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!brutus.cs.uiuc.edu!psuvax1!psuvm!psuecl!c9h From: c9h@psuecl.bitnet Newsgroups: comp.lang.c Subject: Re: Portable use of unions Message-ID: <70105@psuecl.bitnet> Date: 6 Dec 89 02:52:55 GMT References: <203@sixhub.UUCP> Followup-To: comp.lang.c Organization: Engineering Computer Lab, Pennsylvania State University Lines: 23 In article <203@sixhub.UUCP>, davidsen@sixhub.UUCP (Wm E. Davidsen Jr) writes: > > The next to last line (2nd assignment) is flagged with a message of > "conflicting use of union fields in a single statement." I tried it on > seven common compilers and they all liked it. The int value of the union > holds the subscript of the start of the string, while the pointer value > will hold the actual starting address. Obviously only one can be valid > at any given time. This appears to be a poor attempt by the compiler to insure that the [assumed stupid] programmer doesn't use both at the same time. Unfortunately, this only causes problems when you actually have a valid use for it. > I'm willing to be shown that there's a problem here, but only if > either K&R or ANSI says there is. I don't care if people have broken > compilers, that's their problem, right? Yeah. <*heavy* sigh> I concur. It's their problem. -- - Charles Martin Hannum II "Klein bottle for sale ... inquire within." (That's Charles to you!) "To life immortal!" c9h@psuecl.{bitnet,psu.edu} "No noozzzz izzz netzzzsnoozzzzz..." cmh117@psuvm.{bitnet,psu.edu} "Mem'ry, all alone in the moonlight ..."