4 ms·
The only problem that would solve is braindead code like if (something) doThis(); andThat(); which is absolutely absurd to pass even basic cod
by vortico 8y ago
The only problem that would solve is braindead code like
if (something)
doThis();
andThat();
which is absolutely absurd to pass even basic code review. Even most compilers (clang, GCC, etc.) will warn you about that.
What omitting curly braces after `if` statements does do is make code ~1% more readable, which can have massive cumulative positive results in security and stability with a multi-million line codebase.
- Jach 8y agoYou say it's absurd, but many people will instinctively remember goto fail: https://www.imperialviolet.org/2014/02/22/applebug.html https://www.imperialviolet.org/2014/02/22/applebug.html
- 1over137 8y agoclang does not have such a warning, though clang-tidy and GCC do: https://bugs.llvm.org/show_bug.cgi?id=18938 https://bugs.llvm.org/show_bug.cgi?id=18938