On Thu, Nov 08, 2018 at 12:13:31PM -0300, Alvaro Herrera wrote:
> On 2018-Nov-08, Tom Lane wrote:
>> Visually, however, I think this is better off with braces because
>> it *looks* like a multi-line if-block. The braces also make it
>> clear that your intent was not, say,
>>
>> while (some-mutable-condition)
>> /* skip */ ;
>> do_something_else();
>
> Right, that too. Fortunately I think compilers warn about mismatching
> indentation nowadays, at least in some cases.
I don't recall seeing a compiler warning about that, but I do recall
coverity complaining loudly about such things. It is better style to
use braces if there is one line of code with a comment block in my
opinion. And there is no need for braces if there is no comment.
--
Michael