r/cpp • • May 03 '26

The Most Confusing C++ Behavior

https://codestyleandtaste.com/most-confusing-C++-behavior.html
35 Upvotes

51 comments sorted by

View all comments

Show parent comment

1

u/cd_fr91400 May 04 '26

as spaces boost visual clarity by helping the brain to see the parse points.

I fully agree. That's why I write:
value + delta/scale
(value+delta) / scale

In terms of helping the brain to see the parse points, I don't see the difference between no space and spaces around all operators: none of these give visual information.

About * and &, I have never written nor read cases where there are actual confusions. Most code use CamelCase for types and snake_case for variables, or at least distinguish them by the first letter being upper or lower case.

However, in the same idea that "spaces boost visual clarity", I write:
Type* x
Type& x