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]

Re: Does traditional C allow initializing 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.)

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.



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