Portable use of unions
c9h at psuecl.bitnet
c9h at psuecl.bitnet
Wed Dec 6 13:52:55 AEST 1989
In article <203 at sixhub.UUCP>, davidsen at 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 at psuecl.{bitnet,psu.edu} "No noozzzz izzz netzzzsnoozzzzz..."
cmh117 at psuvm.{bitnet,psu.edu} "Mem'ry, all alone in the moonlight ..."
More information about the Comp.lang.c
mailing list