C++ Logo


Advanced search

What's the rational for the precedence of the '.*' and '->*' operators?

From: Shachar Shemesh <shachar_at_[hidden]>
Date: Fri, 14 Jun 2019 14:25:07 +0300


The member/method pointer dereference operators ('.*' and '->*') are listed as having level 4 priority. This means that in the expression:


(which you'll necessarily write in order to dereference b as a pointer to method) the function call operator is evaluated first, so the expression is the same as:


This seems strange, as it guarantees that almost any use of pointers to methods would require extra parenthesis like so:


To me, it seems that those operators should have been at priority level 2 than these parenthesis would have become unnecessary with no adverse effect (at least as far as I could find).

Is there some reason I've missed for defining them at priority level 4?

Thank you,


Received on 2019-06-14 06:26:58