nested unnamed structs/unions broken?
Jim Wilson
wilson@specifixinc.com
Sun Oct 26 18:49:00 GMT 2003
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
More information about the Gcc-bugs
mailing list