3 ms·
Was just discussing this at work. A good compromise would be to allow statements outside of of block-parens only when they are on the same line as the control s
by cmrdporcupine 11y ago
Was just discussing this at work. A good compromise would be to allow statements outside of of block-parens only when they are on the same line as the control statement.
IMHO there should be a -W to enforce this so those of us with -Werror on can catch it and burn it with fire.
Here at Google the style guide requires block-parens always.
- slizard 11y agoIn the project I work on our style also requires block-parens. Sometimes it feels unnecessary, but it does make up in terms of consistency: it's easy to glance through the code and inspect the conditions only. I got used to this quite a bit and these days if I write code outside the project I work on, I d sometimes omit the block-parens, but I always add extra indentation to ensure the condition is visually well-separated, e.g.: if (condition1 || condition2) execute_foo1(with_bar); if (condition3) exectute_foo2();