ptr>a()和 (*ptr).a()有何不同

标准中对于类成员访问有如下说明:

3 If E1 has the type “pointer to class X,” then the expression E1->E2 is converted to the equivalent form (*(E1)).E2;

即对于指向class X类型的指针,E1->E2会被转化成等价的形式(*(E1)).E2,那么对于编译器而言会产生相同的代码,对于机器而言就没有什么差别了。

原文地址:https://www.cnblogs.com/IS2120/p/6746056.html