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]

Re: Is this legal C++?


On Apr 19, 2000, Zack Weinberg <zack@wolery.cumb.org> wrote:

>   (this->*C::oper) (x, y);

> Now I find this somewhat surprising.  Why doesn't the "implicit this"
> syntactic sugar extend to an implicit ->* for references to
> pointer-to-member-function members?

I don't remember the rationale, but I'm pretty sure draft versions of
the Standard required the explicit use of `this->*' in such cases.  I
can't find any such wording in the final Standard, but I don't
remember exactly in which section I (think I :-) had read it, so I may
just not have found it.

> Also, note that G++ insists on the first pair of parentheses;

This is correct, it's a matter of precedence.  Without the
parentheses, it would be parsed as

this->*(C::oper (x, y));

which is totally bogus.

-- 
Alexandre Oliva    Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me


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