Re: PATCH, RFC: 2.6 Documentation/Codingstyle

From: Giuliano Pochini
Date: Fri Feb 13 2004 - 08:58:56 EST



On Fri, 13 Feb 2004, Andries Brouwer wrote:

> I do. (That is, 80xN with N in 24..60 or so.)
>
> The 80 here has a pedagogical and a practical purpose.
> The practical one is that it makes sure that everybody can read the source.
> The pedagogical is to invite you to arrange the code in a different way
> if you are nesting too deeply or your expressions are too complicated.

Deeply nested doesn't mean unreadable or badly structured. 1 tab in the
function, 1tab a switch, 1 if, 1 for, 1 if and you have already lost
half of the available space. It's not difficult to find lines compressed
towards the 79th column in the kernel sources.
I propose to change "hard limit" to "soft limit" to avoid things like this:

rc=idefloppy_begin_format(drive, inode,
file,
(int *)arg);

IMO we should try to keep function calls on the same line. btw it's
only a matter of taste and the compiler accepts ugly code too :))

> There is also ergonomics. There is a reason newspapers do not print
> text across the full width of the page - it would be very difficult
> to read.

Code has only one instruction per line.


--
Giuliano.

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