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

Comments

Luca

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.

Too

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.

The comments to this entry are closed.