This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Does traditional C allow initializing a union?
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: Does traditional C allow initializing a union?
- From: John Carr <jfc at mit dot edu>
- Date: Tue, 13 Oct 1998 07:54:32 EDT
- Cc: egcs at cygnus dot com
> 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.)
I wrote that code and wanted to do the same thing. See the comment
lower down:
/* Assign register numbers to the globally defined register rtx.
This must be done at runtime because the register number field
is in a union and some compilers can't initialize unions. */
(And, I realized later, too many values aren't compile time constants.)
Unless we move to ANSI C, unions can't have non-default initialization.