This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Is this legal C++?
- To: Zack Weinberg <zack at wolery dot cumb dot org>
- Subject: Re: Is this legal C++?
- From: Alexandre Oliva <aoliva at cygnus dot com>
- Date: 19 Apr 2000 18:20:15 -0300
- Cc: gcc at gcc dot gnu dot org
- Organization: Cygnus Solutions, a Red Hat Company
- References: <20000419140804.U10660@wolery.cumb.org>
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