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: Microsoft Specific C++ keyword "__super"


Richard e Collins
www.maddoggames.com
----- Original Message ----- 
From: "Joe Buck" <Joe.Buck@synopsys.COM>
To: "Richard E Collins" <richard@collins1969.fsnet.co.uk>
Cc: <gcc@gcc.gnu.org>
Sent: Wednesday, August 25, 2004 6:14 PM
Subject: Re: Microsoft Specific C++ keyword "__super"


> On Wed, Aug 25, 2004 at 01:01:33PM +0100, Richard E Collins wrote:
> > Is this supported in GCC, if so does it have a different name? Its very
> > handy.
>
> No, it isn't.
Shame.

>
> > The "__super" keyword allows you to call the parent(super) class without
> > needing to know what it is called, here is an example i've copied from
the
> > MS docs.
>
> I suppose that the maintainers might be willing to accept a code
> contribution that implements this extension, but a bit more information
> about how ambiguity is handled would be needed.
>
> > struct B1
> > {
> >     void mf(int);
> > };
> >
> > struct B2
> > {
> >     void mf(short);
> >     void mf(char);
> > };
> >
> > struct D : B1, B2
> > {
> >     void mf(short)
> >     {
> >         __super::mf(1); // Calls B1::mf(int)
> >         __super::mf('s'); // Calls B2::mf(char)
> >     }
> > };
>
> Here we have exact matches.  What if, say, __super::mf(1L) or something is
> called?  One possible approach would be to treat __super::method(...)
> exactly like method(...) would be handled in ISO C++ if the current class
> did not provide any definitions for method (including normal overloading
> resolution).  That would provide a complete, testable rule.  Is that the
> approach that Microsoft uses?
>
    Not sure, i've not used it to death. But for my Windows DX games i've
written a GUI framework which has quite a lot of inheritence kickng off.
GUI's seem to be the best example of C++ inheritence. ;) Anyway i've used
this command because its quicker than looking throw the headers to see which
I need from which parent class. Before I used this key word I had some bugs
slip in when I swapped round two classes, that would not have happened if I
had used '__super'.

    I'm not up and running yet but I will be using Linux and GCC, i'm a
seasoned games coder but very new at Linux. I've used GCC a bit with PS2
work i've done but SN Systems tool chain did most of the work. :-)

I'll have a think, I may resort to a macro plan I had before I found the
'__super' keyword. I do think its an omission of the C++ spec.

>
>
>
>



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