Re: checkpatch guide for newbies

From: Alexander Holler
Date: Wed Sep 25 2013 - 23:30:28 EST


Am 26.09.2013 05:04, schrieb Al Viro:
On Thu, Sep 26, 2013 at 04:57:32AM +0200, Alexander Holler wrote:
Am 26.09.2013 04:52, schrieb Alexander Holler:

I'm aware of people which do nest 8 levels deep just to avoid a return,
break or goto.

But trying to limit that by limiting the line length is like ...
(choose your own own misguided comparison, it's too late for me I
currently only meorize some of those which don't make sense in english)

But I'm still able to offer a solution: ;)

limit the number of tabs, not the line length (at least not to 80).

With that limited (and it's visually harder to keep track of), what's
the problem with 80-column limit on line length? Just how long do
you want those "descriptive names" to be?

Oh, personally I don't have any limit there. ;) I like descriptive function and variable names whenever they make sense. And often they make comments uneccessary and therefor prevent errors because those descriptive names are visible whenever the function or variable is used, and comments usually appear only once and get forgotten when scrolled out of the screen.

But just take a function like

void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim,
struct timespec *wtom, struct timespec *sleep);

I like such function names ;) (ok I wouldn't have use those and), but it's hard to press this into 80 characters, especially when the arguments should have some meaning too (e.g. what does wtom stand for?)

If you use that somewhere you get

get_xtime_and_monotonic_and_sleep_offset(a, b, c)

using silly names and that already is a 58 characters long. So only 22 are left to distribute over 3 variable names. And now think what happens if that wouldn't be a void function.

Regards,

Alexander Holler



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