Re: Designated initializers for fields in anonymous structs and unions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 2, 2014 at 11:31 AM, Derek M Jones <derek@xxxxxxxxxxxx> wrote:
>> .. and in fact I think even without those things, you can just make
>> the unnamed union have a type name, ie
>>
>>     struct S {
>>        union T {
>>            int a;
>>        }
>>     };
>>
>> the union T has a typename, but is a unnamed member of struct S. We
>> could use "union T" later.
>
>
> No such luck, not allowed by the C Standard.
>
> 6.7.2.1p13
> "An unnamed member whose type specifier is a structure specifier with
> no tag is called an anonymous structure; an unnamed member whose type
> specifier is a union specifier with no tag is called an anonymous union"
>
> But you can do this sort of thing when the type specifier is not anonymous.

That is what I recall as well, not part of stander C. If you enable
the "-fplan9-extensions",
Linus' example can pass.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux