« Breaking News: News Broken... | Main | Laughing at Laffer, part 1... »



I couldn't disagree more. A structure has fields to access, a pointer doesn't. You cannot use the same operator symbol for two completely different operations. That would be confusing and misleading at best.

Plus, the arrow is pretty explanatory (it points somewhere) and does not require much more typing than a dot. Moreover, if a reader looks at a fragment of your code can immediately recognize which variables are pointers and which are not, just looking at how you use them.


I could not agree more with the article (better late than never). Luca wrote "You cannot use the same operator symbol for two completely different operations". I beg to disagree - yes you can use the same symbol for two different operations. In fact probably every symbol in C++ has more than 1 meaning depending on context or more overloads based on the type.

Language should be simple to use and if out of 4 possibilities (pointer->field, pointer.field, struct->field, struct.field) 2 produce error, one operator is enough to encode the information.

If hungarian notation + ide highlighting is not enough for somebody to determine on what kind of variable the field is accessed, only OS accessibility features can help.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)