making it easier to use unions

Henry Spencer henry at utzoo.UUCP
Fri Jul 11 03:43:53 AEST 1986


> C++ permits "anonymous unions" ...

Actually, the really old C compilers permitted this too, by accident,
since they had no notion that a struct/union member name "belonged" to
a particular struct/union.  To them, a member name was just an offset
and a type.  Since all offsets in a union are 0, it all worked out.
A certain amount of old code, notably the Unix kernel, relied on this.
This trick broke when member names became local.
-- 
Usenet(n): AT&T scheme to earn
revenue from otherwise-unused	Henry Spencer @ U of Toronto Zoology
late-night phone capacity.	{allegra,ihnp4,decvax,pyramid}!utzoo!henry



More information about the Comp.lang.c mailing list