Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC830713); site tjalk.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!teddy!panda!talcott!harvard!seismo!mcvax!vu44!botter!tjalk!dick From: dick@tjalk.UUCP (Dick Grune) Newsgroups: net.lang.c Subject: Re: Standard for union initialization? Message-ID: <418@tjalk.UUCP> Date: Mon, 21-Jan-85 05:14:05 EST Article-I.D.: tjalk.418 Posted: Mon Jan 21 05:14:05 1985 Date-Received: Wed, 23-Jan-85 06:05:15 EST References: <6995@brl-tgr.ARPA> <7004@brl-tgr.ARPA> <6847@watdaisy.UUCP> <10884@watmath.UUCP> <553@plus5.UUCP> <127@redwood.UUCP> Reply-To: dick@tjalk.UUCP (PUT YOUR NAME HERE) Organization: VU Informatica, Amsterdam Lines: 23 Summary: I saw a suggestion in net.lang.c a few months ago that I found very sensible, readable and hygienic: union { int i; float x; char *str; } ixstr = { , 3.14, }; if you want it to start off as a float, etc. Note that: 1. it is (almost) isomorphous to a struct initialization, 2. it also works nicely for arrays of unions. Dick Grune Vrije Universiteit de Boelelaan 1081 1081 HV Amsterdam the Netherlands ... and my name isn't Richard.