GCC 4.3 C++ question

Benjamin Kreuter ben.kreuter at gmail.com
Sat Feb 9 23:30:55 UTC 2008


On Saturday 09 February 2008 18:23:24 Tim Niemueller wrote:
> Paul Black wrote:
> > Why not:
> > class SomeClass
> > {
> >  public:
> >   SomeClass();
> >   // more stuff...
> >  protected:
> >   struct mylist_t {
> >     mylist_t *next;
> >     void *dataM
> >   };
> > };
>
> Then I cannot use
>   SomeClass::mylist_t *list
> but I would have to use
>   struct SomeClass::mylist_t *list
> which is ugly and this is why I had the typedef in the first place.

That is only true in C.  In C++, struct/union/enum/class names are 
automatically typenames.

> I just wonder if this is indeed the intended behavior, typedef are not
> allowed as members,

I am not familiar; usually you see typedefs at the global or namespace scope, 
and usually they follow the class or struct declaration.

-- Benjamin Kreuter



-- 
Message sent on: Sat Feb 9 18:29:30 EST 2008
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/fedora-devel-list/attachments/20080209/c7df1cb4/attachment.sig>


More information about the fedora-devel-list mailing list