Mandatory use of braces

The best counter argument I can offer is that the extra line(s) taken up by the space reduce the amount of code you can see at one time, and the amount of code you can see at one time is a big factor in how easy it is to spot errors. I agree with the reasons you've given for including braces, but in many years of C++ I can only think of one occasion when I made a mistake as a result and it was in a place where I had no good reason for skipping the braces anyway. Unfortunately I couldn't tell you if seeing those extra lines of code ever helped in practice or not.

I'm perhaps more biased because I like the symmetry of matching braces at the same indentation level (and the implied grouping of the contained statements as one block of execution) - which means that adding braces all the time adds a lot of lines to the project.


I enforce this to a point, with minor exceptions for if statements which evaluate to either return or to continue a loop.

So, this is correct by my standard:

if(true) continue;

As is this

if(true) return;

But the rule is that it is either a return or continue, and it is all on the same line. Otherwise, braces for everything.

The reasoning is both for the sake of having a standard way of doing it, and to avoid the commenting problem you mentioned.