This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Unnamed unions
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Subject: Re: Unnamed unions
- From: James Dennett <jdennett at acm dot org>
- Date: Sat, 17 Feb 2001 00:33:34 +0000
- CC: "Timothy J. Wood" <tjw at omnigroup dot com>, gcc at gcc dot gnu dot org
- References: <200102170026.TAA20159@bethe.phy.uc.edu>
Andrew Pinski wrote:
>
> In the newer builds of gcc it is supported, that least in the 3.0 branch.
> I tested on a cvs updated source (around 5am EST today). It worked, might be
> a trouble with Apple's compiler
> Thanks,
> Andrew Pinski
>
> >
> >
> > Maybe this is the issue...
> >
> > I'm building with the C compiler, not the C++ compiler (since all the
> > files are .c files and since I need to access ObjC anyway).
> >
> > If I build with the C++ compiler, it does work, but if I do:
> >
> > cc -Wall -O2 -ansi -pedantic /tmp/foo.c -o /tmp/foo
> >
> > I get:
> >
> > /tmp/foo.c:12: warning: ANSI C forbids member declarations with no
> > members
> > /tmp/foo.c:12: warning: unnamed struct/union that defines no instances
> > /tmp/foo.c: In function `main':
> > /tmp/foo.c:20: structure has no member named `a'
> >
> > So, I guess I'll just replace these by hand.
> >
> > Thanks!
With my gcc, even compiling as C, this is only a warning. Your code
still compiles and runs. Maybe an up-to-date gcc would be the thing
for you. Either a snapshot now, or if you can wait a while, gcc 3.0
will be out within months, and it is a wonderful thing (well, if you
are a C++ fan it's wonderful).
-- James Dennett