Re: [PATCH 07/16] GFS2: Directory handling

From: Ingo Molnar
Date: Tue Sep 05 2006 - 07:27:29 EST



* Jan Engelhardt <jengelh@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/