Re: [PATCH][1/5][resend] floppy.c: Initial (partial) CodingStyle cleanup

From: Adrian Bunk
Date: Mon Mar 19 2007 - 16:20:32 EST


On Mon, Mar 19, 2007 at 07:18:38PM +0100, Jesper Juhl wrote:
>...
> The second reason is that indenting two tabs seems to make the most sense for
> a few reasons;
> a) not indenting at all is ugly, plain and simple.
> void function(int a, int b,
> int c, int d, int e)
> {
> int foo;
> int bar;
> ...
> }
> b) indenting only one tab stop puts parameters at the same indent level as
> variables in the function which is potentially confusing (at least IMHO).
> void function(int a, int b,
> int c, int d, int e)
> {
> int foo;
> int bar;
> ...
> }
> c) Indenting so that all parameter lines start at the opening paranthesis
> rarely matches up with tabs so you have to use varying amounts of spaces
> depending on how long the function name is. Not a good solution IMHO.
> void function(int a, int b,
> int c, int d, int e)
>...

Your example is wrong, it's:

void function(int a, int b,
int c, int d, int e)


This is the most common convention in the kernel - and except for
extremely long function names it's the one with the best readability.

Yes, it's a problem with extremely long function names, but they are
rare in the kernel.

And the "varying amounts of spaces" should be handled automatically by
your editor.

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

-
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/