This is the mail archive of the gcc-bugs@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: Feature-request: Possibility of transparent unions in structs


> 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


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