Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!uicsrd!mcdaniel From: mcdaniel@uicsrd.CSRD.UIUC.EDU Newsgroups: net.lang.c Subject: Re: making it easier to use unions Message-ID: <19600002@uicsrd> Date: Sun, 6-Jul-86 21:14:00 EDT Article-I.D.: uicsrd.19600002 Posted: Sun Jul 6 21:14:00 1986 Date-Received: Thu, 10-Jul-86 01:49:12 EDT References: <1725@brl-smoke.ARPA> Lines: 32 Nf-ID: #R:brl-smoke.ARPA:1725:uicsrd:19600002:000:833 Nf-From: uicsrd.CSRD.UIUC.EDU!mcdaniel Jul 6 20:14:00 1986 C++ permits "anonymous unions" like struct { union { int x; char * y; }; int z; } zap; so zap.z = zap.x; is legal. I don't find it confusing. [I think that anonymous structs should likewise be permitted in C++ -- which is outside the scope of C.] In such a case, I would say struct { /* or union if appropriate */ int x; char * y; }; int z; outside another struct/float would likewise define 3 external variables named x, y, and z. Anonymous structs could thus be described as only for purposes of grouping (like parentheses) but do not affect scope; all identifiers declared therein are "exported" to the next scope out, whatever it may be. Anonymous unions would be for grouping and for storage overlay. As for C: probably too late to add anonymity. Anonymous is a lousy keyword: too hard to speel.