4 ms·
Agreed. The author focuses on the right and wrong of things, but it is really about conventions. One could argue that opening brace on the same line makes code
by justanotheratom 14y ago
Agreed. The author focuses on the right and wrong of things, but it is really about conventions.
One could argue that opening brace on the same line makes code look more "natural", or opening brace on a new line makes it look more "symmetric". But instead of reasoning about which way is better or worse, one should focus on coming up with a rule that is prescriptive and covers all cases.
For example, the "opening brace placement" rule should prescribe the position of the brace in all these cases (for C language):
1. if and for loops
2. Function definition
3. Switch statements