Re: PATCH, RFC: 2.6 Documentation/Codingstyle

From: Angelo Dell'Aera
Date: Fri Feb 13 2004 - 09:37:04 EST


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 13 Feb 2004 14:55:13 +0100 (CET)
Giuliano Pochini <pochini@xxxxxxxx> wrote:

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

I think you're really wrong since "deeply nested" means exactly "unreadable
and badly structured" and you could easily realize it by simply spending ~10
hours per day coding and/or taking a look at the code written by someone
which is not you. A simple use of inline functions and a previous thinking
about what you're going to write could easily solve all problems.

>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);

No one is saying this line of code is the best one could imagine... have you
ever thought that maybe anything "floating around" that code line could be
written in a not-well structured way?

>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 :))

A compiler should do it, a maintainer IMHO should not for a really simple
reason: readability (which in most cases means maintainability 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.

Not a good point.


Regards.

- --

Angelo Dell'Aera 'buffer'
Antifork Research, Inc. http://buffer.antifork.org

PGP information in e-mail header


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFALOC+pONIzxnBXKIRApWFAJ9JjvwcnfgPz1V5bvfwzjE2Xb7c5wCfWdOH
s9fGQvTBV3iEaZQdy8tp8nQ=
=v4FT
-----END PGP SIGNATURE-----
-
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/