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]
Other format: [Raw text]

Re: nested unnamed structs/unions broken?


Steve Watt wrote:
union optid {
unsigned int opcode_tid;
struct {
unsigned int opcode:8;
unsigned int tid:24; };
};

You now need the -fms-extensions option in order for gcc to accept this. This feature was originally added because it was used in MS Windows header files, and was thus needed by cygwin. Some people objected to the feature when it accidentally turned up in other places, so now it only gets enabled if you explicitly ask for MSC compatibility.


There is one case that gcc continues to accept by default, because it was agreed to be generally useful. This is the case of a union inside a struct, where the union has no type name and no field name. This is the case documented in the gcc manual in the Unnamed Fields node.
http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Unnamed-Fields.html#Unnamed%20Fields
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



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