[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] virsh: print error in case of cellno is invalid



On Wed, Jan 05, 2011 at 10:10:00AM -0700, Eric Blake wrote:
> 
> Style nit: you used:
> 
> if (cond) {
>    abc;
>    def;
> } else
>    xyz;
> 
> But we prefer either:
> 
> if (!cond)
>    xyz;
> else {
>    abc;
>    def;
> }
> 
> or:
> 
> if (cond) {
>    abc;
>    def;
> } else {
>    xyz;
> }
> 
> since HACKING documents that an else clause should only ever omit braces
> when the if clause also omitted braces, but an if clause can omit braces
> even when the else clause requires them.

Hmm, I didn't notice that. I really don't like to see braces in
else clauses, without also seeing braces in the if, and have
been fixing this to add braces whenever I come across it. IMHO
the hacking guideline should only allow

  if (foo)
    bar;
  else
    wizz;

Or

  if (foo) {
    bar;
    ...
  } else {
    wizz;
    ...
  }

Regards,
Daniel


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]