Re: kernel guide to space

From: Richard B. Johnson
Date: Tue Jul 12 2005 - 07:24:33 EST


On Tue, 12 Jul 2005, Patrick McHardy wrote:

Denis Vlasenko wrote:
text with 8-char tabs:

struct s {
int n; /* comment */
unsigned int u; /* comment */
};

Same text viewed with tabs set to 4-char width:

struct s {
int n; /* comment */
unsigned int u; /* comment */
};

Comments are not aligned anymore

Best rule IMO is to use tabs for indentation and spaces for alignment.
This way tab size can be changed without breaking alignment.

Or just disallow tabs altogether. At Analogic we had several hundred
thousand lines of imaging code from various engineers around the world.
They would set their tabs so everything looked fine on their computers.
On other computers, it looked like hell so engineers who had to
merge code spent hundreds of wasted hours lining up the code. The
"cleanup" work never stopped! That was until, we made a rule that
all code would be run through a filter that would remove tabs and
substitute spaces (of the width the writer intended). No code that
is released contains even a single tab anymode.

The files are larger of course, but even lap-tops have gigabyte
drives now-days and the duplicate spaces give compression utilities
something to do.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.12 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.
-
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/