This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Does traditional C allow initializing a union?


(Okay this is a C question not an egcs one, but it relates to egcs code.)

	Does traditional C allow initializing a union?  Eg:

 > typedef union rtunion_def
 > {
 >   long rtwint;
 >   int rtint;
 >   char *rtstr;
 > } rtunion;
 > 
 > static rtunion foo = {0};

	This works under all ansi compilers I've found, but it fails for
me on SunOS4 cc and Irix4 'cc -cckr'.  Is there another way to
initialize a union?

	I'm trying to get emit-rtl.c: global_rtl.fld[] initialized by
using {{0}} (double nesting since its an array) and it doesn't work in
the traditional C case, (just as with the above code.)

		--Kaveh
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Icon CMT Corp.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]