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"


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?





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