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: Unnamed unions


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


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