unions or automatic aggregates cannot be initialized. Why?

Michael J. Eager meager%playland at Sun.COM
Tue Jan 9 13:59:03 AEST 1990


In article <915 at mbf.UUCP> kris at 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



More information about the Comp.lang.c mailing list