This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Should typedef'd unnamed structs be supported?


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]