Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Union initialization Message-ID: <1989Feb19.000513.4334@utzoo.uucp> Organization: U of Toronto Zoology References: <816@atanasoff.cs.iastate.edu> Date: Sun, 19 Feb 89 00:05:13 GMT In article <816@atanasoff.cs.iastate.edu> hascall@atanasoff.cs.iastate.edu (John Hascall) writes: > Does 'ANSI' C allow for union initialization? If not, why not? Yes it does. But you won't like it. Initialization of a union is initialization of the first member. Nobody thinks this is wonderful, but it does at least define (e.g.) the initial value of a static union, and it has the virtue that it has been implemented and found workable. Designing a more general facility is tricky -- you really have to name the member you're initializing, it can't always be guessed from the type of the value -- and there doesn't seem to be a desperate need for it, since we've been living without it for a long time. I believe there were some union-initialization proposals to X3J11, none of which got enough support to make it in. -- The Earth is our mother; | Henry Spencer at U of Toronto Zoology our nine months are up. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu