* Jan Engelhardt <[email protected]> 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]