ptr->hello(); /* VERSUS */ (*ptr).hello();
问题 I was learning about C++ pointers and the -> operator seemed strange to me. Instead of ptr->hello(); one could write (*ptr).hello(); because it also seems to work, so I thought the former is just a more convenient way. Is that the case or is there any difference? 回答1: The -> operator is just syntactic sugar because (*ptr).hello() is a PITA to type. In terms of the instructions generated at the ASM level, there's no difference. In fact, in some languages (D comes to mind), the compiler figures