This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Should typedef'd unnamed structs be supported?
- From: Richard Henderson <rth at redhat dot com>
- To: Philipp Thomas <pthomas at suse dot de>, gcc at gcc dot gnu dot org
- Date: Wed, 26 Mar 2003 17:53:43 -0800
- Subject: Re: Should typedef'd unnamed structs be supported?
- References: <20030325173813.GI21892@paradies.suse.de>
On Tue, Mar 25, 2003 at 06:38:14PM +0100, Philipp Thomas wrote:
> One of the GCC extensions is to allow unnamed structs and unions as
> fields of a structure. Question now is, if that should also apply
> to typedefs, i.e:
Yes. Indeed, this is implemented.
/* This is an unnamed decl.
If we have something of the form "union { list } ;" then this
is the anonymous union extension. Similarly for struct.
If this is something of the form "struct foo;", then
If MS extensions are enabled, this is handled as an
anonymous struct.
Otherwise this is a forward declaration of a structure tag.
If this is something of the form "foo;" and foo is a TYPE_DECL, then
If MS extensions are enabled and foo names a structure, then
again this is an anonymous struct.
Otherwise this is an error.
Oh what a horrid tangled web we weave. I wonder if MS consciously
took this from Plan 9 or if it was an accident of implementation
that took root before someone noticed the bug... */
Though you should note that none of this abomination is active
unless -fms-extensions. Nor is it documented, though I suppose
that's a mistake.
r~