This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
anonymous structs in unions
- From: Mihnea Balta <dark_lkml at mymail dot ro>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 27 Feb 2003 14:36:55 +0200
- Subject: anonymous structs in unions
I've found out quite a while ago that gcc and g++ don't like constructs like:
union something{
struct{
int a, int b;
};
struct{
float c, d;
};
} a;
a.c = 12.f;
So far, the only place where I've gotten problems because of this was code
that defined matrices as unions of a float array and a float struct, and that
was quickly fixed by some #defines. Anyway, right now I have to port some
visualc code to g++/linux and I stumbled across this problem in other areas
which are harder to modify (mainly because the rest of the team members
opposing to changing half their code :) and secondly because some hairy bit
unions come into play).
My theoretical question is if this feature was not included in gcc/g++ because
it does not comply with ANSI or for other reasons. My practical question is
if anything can be done besides convincing my team mates to rewrite code or
hacking gcc.
Thanks.