This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Does traditional C allow initializing a union?
- To: egcs at cygnus dot com
- Subject: Does traditional C allow initializing a union?
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Mon, 12 Oct 1998 23:53:00 -0400 (EDT)
- Cc: ghazi at caip dot rutgers dot edu
(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.