Path: utzoo!attcan!uunet!dino!cs.iastate.edu!hascall From: hascall@cs.iastate.edu (John Hascall) Newsgroups: comp.lang.c Subject: Downward compatible extension to unions Message-ID: <592@dino.cs.iastate.edu> Date: 13 Feb 90 16:15:36 GMT Sender: usenet@dino.cs.iastate.edu Organization: Iowa State Univ. Computation Center Lines: 23 The more I think about the ANSI standard for union initialization, the more I fail to understand it. Was the following suggested, and if so, what were the reasons for rejecting it? Make union initialization parallel to struct initialization except that only one element may be specified. struct FOO { union FOO { char bar; char bar; int baz; int baz; long buz; long buz; } examp = { 'C', 42, 61762 }; } examp = { , 42, }; Note that this method would not break existing code using the "initialize the first element" rule (assumming trailing commas were optional). The real usefulness is when you have an array of unions which you may want to be initialize differently: union FOO things[3] = { {,42,}, {'C',,}, {,,61762}, }; John Hascall / ISU Comp Ctr, Ames IA / hascall@atanasoff.cs.iastate.edu