This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Unnamed UNION and STRUCT members
- To: egcs at cygnus dot com
- Subject: Unnamed UNION and STRUCT members
- From: "Pavel Pisa;research student" <pisa at waltz dot felk dot cvut dot cz>
- Date: Tue, 17 Nov 1998 19:00:14 +0100 (MET)
I have tried mingw32 to compile NT drivers.
I have next problem with DDK headers.
(very simplified example follows)
struct {
union{
int ua;
char ub;
};
} s;
main()
{
s.ua=s.ub;
};
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.
I know that it is not ANSI and should be disabled for ANSI
compile, but GCC has many important and usesfull extensions
so why not that.
It can be probably changed in c-parse.in somewhere
about shadow_warning and member_decl in structure and union
grammar, but I am not expert.
Please, if you have found a time, say me, what you are
thinking about this and if you can help me how to patch EGCS-1.1b
to compile above code.
I prefer, if you can CC to my e-mail too.
Thanks for any response
Pavel Pisa
pisa@cmp.felk.cvut.cz