This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Unnamed UNION and STRUCT members
- To: pisa at waltz dot felk dot cvut dot cz (Pavel Pisa;research student)
- Subject: Re: Unnamed UNION and STRUCT members
- From: Joe Buck <jbuck at synopsys dot com>
- Date: Tue, 17 Nov 98 18:24:10 PST
- Cc: egcs at cygnus dot com
> It seems to be M$ extension to C to allow unnamed members
> in structs and unions and members of these unnamed members
> can be accessed by its name in name space of containing structure
> or union.
> It is interesting, that "C" frontend of EGCS generates
> errors for both (unions and structs) but "C++" can compile
> above example without problems, but reverse of union and
> struct ends with error.
That's because anonymous unions are a standard C++ feature but are
not present in C. Unfortunately several vendors with common C/C++
front ends backported some C++ features to C without alerting users
to this fact. (gcc surrendered on // comments, kind of wish it hadn't).