This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Microsoft Specific C++ keyword "__super"
- From: "Richard E Collins" <richard at collins1969 dot fsnet dot co dot uk>
- To: <gcc at gcc dot gnu dot org>
- Date: Wed, 25 Aug 2004 19:14:53 +0100
- Subject: Re: Microsoft Specific C++ keyword "__super"
- References: <001901c48a9b$45b6ac20$291b4f51@p3800> <20040825101420.A26951@synopsys.com>
- Reply-to: "Richard E Collins" <richard at collins1969 dot fsnet dot co dot uk>
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.
>
>
>
>