This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Microsoft Specific C++ keyword "__super"
- From: Joe Buck <Joe dot Buck at synopsys dot COM>
- To: Richard E Collins <richard at collins1969 dot fsnet dot co dot uk>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 25 Aug 2004 10:14:20 -0700
- Subject: Re: Microsoft Specific C++ keyword "__super"
- References: <001901c48a9b$45b6ac20$291b4f51@p3800>
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.
> 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?