4 ms·
The bugs being referred to are from optional brackets in C: void foo() { ... if (expr) doA(); doB(); ...
by akubera 5y ago
The bugs being referred to are from optional brackets in C:
void foo() {
...
if (expr)
doA();
doB();
...
}
which is unambiguous to the compiler, but could (and I expect would, especially when glancing through a lot of code) cause misinterpretation by a human reader. We can more easily hallucinate the brackets than the indentation.
I disagree with the idea that indentation spaces are invisible; rather they are much more visible than a pair of brackets. This actually becomes a problem when you embed/indent too much and 70% of the line is spaces. It's all you see!
- secondcoming 5y agoYes, but pretty much every coding standard I've seen mandates the use of braces always. You do it without even thinking. Your example wouldn't pass code review.