Re: CodingStyle question: multiple statements on a single line

From: Frans Meulenbroeks
Date: Wed Sep 03 2008 - 02:57:48 EST


2008/9/3 Hans Verkuil <hverkuil@xxxxxxxxx>:
[...]
>
> "Don't put multiple statements on a single line unless you have
> something to hide:
>
> if (condition) do_this;
> do_something_everytime;
>
> Don't put multiple assignments on a single line either. Kernel coding
> style is super simple. Avoid tricky expressions."
>
> Does this mean:
>
> 1) Yes, after an 'if' you can put a single statement like this:
>
> if (a) b;
>
> 2) No, never use the 'if (a) b;' construction. Put 'b;' on the next line
> instead.
>

It means 2. The example is definitely tricky. At first sight the
indentation suggests that the 'do_something-everytime" belongs to the
if, so it might put people on the wrong foot.
Suggest the text to be revised though. Some of us are better in
English than others. No need to cause confusion...

just my two eurocents :-)

Frans

[...]
--
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/