Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.lang.c Subject: Re: initialization of unions Message-ID: <32543@sun.uucp> Date: Fri, 30-Oct-87 19:28:26 EST Article-I.D.: sun.32543 Posted: Fri Oct 30 19:28:26 1987 Date-Received: Wed, 4-Nov-87 23:21:12 EST References: <165600017@uiucdcsb> <356@xyzzy.UUCP> Sender: news@sun.uucp Lines: 23 "Next User-id to allocate"? > Note, there have been some people who wrote in and said they thought the > first member business was for the birds, and proposed various means to > specify which member gets initialized. My personal feeling is the first > member is more in the spirit of K&R C, and that a much better scheme would > be to allow you to specify the name of the field being initialized ala ADA. > I don't know how many times I have changed the order of fields in a structure > and then had to go find all cases of initialization and fix them as well. Not to mention the fact that, when initializing an array of unions or objects containing unions, the "first member" rule is useless unless for *every* element of the array the first member of *all* unions in *every* array element is the one that you want to initialize. The only thing the "first member" array is good for is giving a meaning to the *implicit* initialization of static objects. It's better than nothing, as long as 1) it doesn't preclude doing something better in the future and 2) doesn't give anybody the false impression that the problem of initializing unions has been solved - it hasn't been, it's just that one immediate need for a solution has been postponed by the first member kludge. Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com