Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!sun-barr!newstop!sun!playland!meager From: meager%playland@Sun.COM (Michael J. Eager) Newsgroups: comp.lang.c Subject: Re: unions or automatic aggregates cannot be initialized. Why? Message-ID: <130015@sun.Eng.Sun.COM> Date: 9 Jan 90 02:59:03 GMT References: <915@mbf.UUCP> Sender: news@sun.Eng.Sun.COM Reply-To: meager@sun.UUCP (Michael J. Eager) Distribution: na Organization: Sun Microsystems, Mountain View Lines: 30 In article <915@mbf.UUCP> kris@mbf.UUCP (A. Krishna Murthy) writes: > > Hi folks, > > In the definitive text 'The C Programming Language' by > Brian W kernighan and Dennis M Ritchie, > Appendix A: C Reference Manual, section 8.6 Initialization, > paragraph four, emphatically states > > "It is not permitted to inititalize unions or automatic aggregates." > > Why? > > Note: > The above statement is with regard to the definition of the language > and NOT to any implementation difficulties. > > Answers will be very much appreciated. > > kris. The ANSI Standard for C permits initialization of automatic aggregates. Not every compiler supports this, even when they claim to support the ANSI Standard. (I'm not sure that I would describe K&R as definitive -- the ANSI Standard for C defines many behaviors which K&R merely imply.) -- Michael J. Eager