This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Feature-request: Possibility of transparent unions in structs
- To: gandalf at winds dot org
- Subject: Re: Feature-request: Possibility of transparent unions in structs
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Sat, 25 Mar 2000 09:55:08 +0100
- CC: gcc-bugs at gcc dot gnu dot org
- References: <Pine.LNX.4.21.0003242246090.16101-100000@winds.org>
> Can anyone tell me if this feature exists currently in GCC (as a C
> extension), or if possible, can be added to gcc 2.96 / 3.0?
Thanks for your bug report. Please note that, in C++, you can write
struct foo {
int type;
union {
int id;
int *data;
char *string;
};
};
and then access the union fields transparently. I've added a
change-request to GNATS. Please also have a look at
http://gcc.gnu.org/cgi-bin/fom.cgi?file=12
Regards,
Martin