lkml.org 
[lkml]   [2006]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/16] GFS2: Directory handling

* Jan Engelhardt <jengelh@linux01.gwdg.de> wrote:

> >Secondly, whenever we have curly braces in the first block, we tend to
> >do it in the second block too, for easier parsing. I.e.:
> >
> > if ((char *)cur + cur_rec_len > bh_end) {
> > gfs2_consist_inode(dip);
> > return -EIO;
> > } else {
> > if ((char *)cur + cur_rec_len == bh_end)
> > return -ENOENT;
> > }
>
> I would very much like to do just this
>
> many insns;
> } else if(...) {
> single insn;
> }

yeah, almost - what we want is:

many insns;
} else if (...) {
single insn;
}

;-)

> but again, some people think no {} should be there because it's just a
> single insn. [...]

i used to be such a person but got converted: it makes visual sense to
have symmetry of curly braces. So it's fine to have:

if (...)
single insn;
else
single insn;

but otherwise, if any of the blocks grows larger than 1 line, it should
be curly braces all around.

Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-09-05 13:33    [W:0.053 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site