Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site watdaisy.UUCP Path: utzoo!watmath!watdaisy!ndiamond From: ndiamond@watdaisy.UUCP (Norman Diamond) Newsgroups: net.lang.c Subject: Re: Standard for union initialization? Message-ID: <6847@watdaisy.UUCP> Date: Mon, 7-Jan-85 12:50:32 EST Article-I.D.: watdaisy.6847 Posted: Mon Jan 7 12:50:32 1985 Date-Received: Tue, 8-Jan-85 03:09:35 EST References: <6995@brl-tgr.ARPA> <7004@brl-tgr.ARPA> Organization: U of Waterloo, Ontario Lines: 36 > > why not use a more general scheme like > > > > union { > >foo; > > bar; > > mumble; > > } baz.mumble = ; > > But "baz.mumble" is not what you want the union to be called. > This addition would certainly make for a messier language > syntax definition. Why not fix the syntax of that scheme and use its semantics: union { foo; bar; mumble; } baz = (type3) ; Suppose the same type is duplicated in the union, e.g. suppose type3 is the same as type1 and the compiler doesn't know whether to initialize foo or mumble? Let the compiler choose whichever valid one it wishes; the result would be equivalent. This would not make the language any messier; it is better than many other examples of casts. And it would be useful, and it would not break existing programs. -- Norman Diamond UUCP: {decvax|utzoo|ihnp4|allegra|clyde}!watmath!watdaisy!ndiamond CSNET: ndiamond%watdaisy@waterloo.csnet ARPA: ndiamond%watdaisy%waterloo.csnet@csnet-relay.arpa "Opinions are those of the keyboard, and do not reflect on me or higher-ups."