From mboxrd@z Thu Jan 1 00:00:00 1970 From: Derek M Jones Subject: Re: Designated initializers for fields in anonymous structs and unions Date: Sat, 02 Aug 2014 19:31:20 +0100 Message-ID: <53DD2E78.2050609@knosof.co.uk> References: <20140731181006.GA13180@cloud> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mdfmta010.mxout.tch.inty.net ([91.221.169.51]:53897 "EHLO smtp.demon.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754675AbaHBSlO (ORCPT ); Sat, 2 Aug 2014 14:41:14 -0400 Received: from smtp.demon.co.uk (unknown [127.0.0.1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mdfmta010.tch.inty.net (Postfix) with ESMTP id 7A667400C54 for ; Sat, 2 Aug 2014 19:34:06 +0100 (BST) In-Reply-To: Sender: linux-sparse-owner@vger.kernel.org List-Id: linux-sparse@vger.kernel.org To: Linus Torvalds , Christopher Li Cc: Josh Triplett , Sparse Mailing-list Linus, > .. 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. -- Derek M. Jones tel: +44 (0) 1252 520 667 Knowledge Software Ltd blog:shape-of-code.coding-guidelines.com Software analysis http://www.knosof.co.uk