lkml.org 
[lkml]   [2012]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch cr 2/4] [RFC] syscalls, x86: Add __NR_kcmp syscall v7

* Cyrill Gorcunov <gorcunov@openvz.org> wrote:

> > > + get_random_bytes(&cookies[i][j],
> > > + sizeof(cookies[i][j]));
> >
> > ugly line break.
> >
>
> Why? Looks pretty good to me. But sure I'll change it.

It's ugly because it serves no purpose other than pacifying
checkpatch and makes the code *uglier*.

It's a disease. When checkpatch tells you "this line is too
long" then consider it a code cleanliness warning!

And code
readability and cleanliness
is not improved
by random line-
breaks, right?

'breaking the line' is the *wrong fix* in roughly 90% of the
cases.

So instead of dumbly breaking the line you need to think about
*WHY* the line got too long, not just mechanically work around
the checkpatch warning!

Too long lines can have many reasons, it's usually one of
several reasons:

- too much nesting due to too large function.
solution: break up the function
or: - too verbose statements with not enough abbreviation
solution: find a more compact way to write it

or if the code looks compact enough and is not over-nested then
*leave the line alone*. By breaking it you have not improved -
you have made it worse.

Thanks,

Ingo


\
 
 \ /
  Last update: 2012-02-03 10:13    [W:0.110 / U:0.804 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site