linux 2.6.29中net_device中的无名结构体---gcc解释

 

5.47 Unnamed struct/union fields within structs/unions.
For compatibility with other compilers, GCC allows you to define a structure or union that
contains, as fields, structures and unions without names. For example:
struct
{
        int a;
        union
       {
           int b;
           float c;
        }
        int d;
} foo;
In this example, the user would be able to access members of the unnamed union with
code like ‘foo.b’. Note that only unnamed structs and unions are allowed, you may not
have, for example, an unnamed int.
You must never create such structures that cause ambiguous(引起歧义的) field definitions. For example,
this structure:
struct
{
       int a;
       struct
     {
           int a;
      };
} foo;

你可能感兴趣的:(c,结构体,gnu,无名)