Re: CodingStyle question: multiple statements on a single line
From: Krzysztof Halasa
Date: Wed Sep 03 2008 - 08:16:00 EST
Roland Dreier <rdreier@xxxxxxxxx> writes:
> This is correct. Always write simple if statements as
>
> if (a)
> b;
The CodingStyle should never say "never" (nor "always").
Consider:
if (a) b;
else if (c) d;
else if (e) f;
etc.
If the list is long and expressions simple this is IMHO much more
readable. The same with
switch (a) {
case b: c; break;
case d: e; break;
and so on.
> Keep in mind that common sense always trumps any mechanical rule.
Precisely.
--
Krzysztof Halasa
--
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/