David Sun's Blog

This isn't the blog you're looking for.

Looks Weird in C

There’s plenty of things you can do in C that just visually look weird. I came across one today that I wanted to write:

ptr++->field

There’s nothing wrong with it. It works. It’s not ambiguous. But it just looks weird. A dash right next to a plus? I put in some parentheses to make it look less weird.

(ptr++)->field

Phew! That’s better! Maybe it’s just me?


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.