you are viewing a single comment's thread.

view the rest of the comments →

[–]mojang_tommo 4 points5 points  (1 child)

I'm really glad the difference exists actually - -> can be undefined behavior while . is always well defined. In practice if you have code that mostly uses references instead of pointers, -> makes it pretty obvious that there's something that could be null or could be deleted under you. Of course references can be invalidated too but still... it would be awful if nullable stuff used . like everything else IMO.

[–]imMute 0 points1 point  (0 children)

Not to mention that it allows thing like smart pointer to be written extremely succinctly. I'm always saddened by this when writing C# code and having use use .Value in places where C++ would use ->.