kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Holler <holler@ahsoftware.de>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Peter Senna Tschudin <peter.senna@gmail.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	kernel-janitors@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: checkpatch guide for newbies
Date: Tue, 24 Sep 2013 22:10:57 +0000	[thread overview]
Message-ID: <52420DF1.7060108@ahsoftware.de> (raw)
In-Reply-To: <CAErSpo4X0-PEYtZrY2r4GKmzTJhHK3eKdXrbccJhB7wVkVCYLA@mail.gmail.com>

Am 24.09.2013 22:13, schrieb Bjorn Helgaas:
> On Tue, Sep 24, 2013 at 1:29 PM, Peter Senna Tschudin
> <peter.senna@gmail.com> wrote:
>> On Tue, Sep 24, 2013 at 7:26 PM, Alexander Holler <holler@ahsoftware.de> wrote:
>>>> On Mon, Sep 23, 2013 at 3:01 AM, Dan Carpenter <dan.carpenter@oracle.com>
>>>> wrote:
>>>>>
>>>>>                   Long Lines
>>>>>
>>>>> Historically screens were 80 characters wide and it was annoying when
>>>>> code went
>>>>> over the edge.  These days we have larger screens, but we keep the 80
>>>>> character
>>>>> limit because it forces us to write simpler code.
>>>
>>> Sorry, but that just isn't true and never was. Having a line wide limit of
>>> 80 characters while forcing tabs to be 8 characters long limits most code to
>>> just 72 characters. And even less (max 64) inside constructs like if, for or
>>> while.
>>>
>>> The only outcome of that totally silly rule is that variable names will
>>> become shorted to silly acronyms almost nobody does understand make code
>>> unreadable.
>
> In the context of a two-sentence paragraph, Dan's original text is
> pithy and accurate.  A Wikipedia article would deserve more
> elaboration.
>
> Obviously the skill of the programmer is the overwhelming factor, but
> I think restricting the line length does help encourage simpler,
> better-factored code.  It's also part of the whole "it's better to be
> consistent than to be better" thing.  If 95% of the files in Linux use
> 80-character lines and the remainder use longer lines, it's just an
> ongoing hassle for the reader.
>
>>> I always feel like beeing in the IT stone age when programmers thought they
>>> have to use variable names like a, b and c to save storage, memory or to
>>> type less when reading linux kernel code.
>> I was about to disagree because I've never seen variables named a, b
>> or c, but I found that there are at least 2238 variables named a, b or
>> c in linux-next. This is not good.
>
> That is not self-evident.  In many cases, e.g., loop iterators, simple
> names are fine.  Nothing is gained by renaming a loop counter from "a"
> to "array_index."  Simple names for simple things help the reader
> focus on more important aspects of the code.

Sure and I'm the last one who wants that people do have to use anything 
else than i for simple loop counters. And allowing longer lines doesn't 
mean people have to use long names, it allows them use them (if it makes 
sense). That's a big difference.

On the other side it's almost impossible to use verbose variable or 
function names where they would make sense. Not to speak about all the 
ugly splitted lines just to be below that ancient CGA limit.

So such a limit doesn't enforces or helps people to write simpler code. 
It encourages using silly names and confusing line breaks, but in no way 
it helps in writing more simple code. It might make help to keep the 
code base consistent in regard to line lengths and confusing line 
breaks, but that's almost all it does.

Regards,

Alexander Holler

  reply	other threads:[~2013-09-24 22:10 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-23  9:01 checkpatch guide for newbies Dan Carpenter
2013-09-23 12:46 ` Peter Senna Tschudin
2013-09-23 13:29   ` Dan Carpenter
2013-09-23 14:04   ` Geert Uytterhoeven
2013-09-23 18:06 ` Joe Perches
2013-09-23 20:17   ` Joe Perches
2013-09-23 18:35 ` bojan prtvar
2013-09-24 16:36 ` Bjorn Helgaas
2013-09-24 17:26   ` Alexander Holler
2013-09-24 17:43     ` Alexander Holler
2013-09-24 18:50       ` Alexander Holler
2013-09-24 19:29     ` Peter Senna Tschudin
2013-09-24 19:59       ` Dan Carpenter
2013-09-24 20:13       ` Bjorn Helgaas
2013-09-24 22:10         ` Alexander Holler [this message]
2013-09-26  2:11           ` Al Viro
2013-09-26  2:52             ` Alexander Holler
2013-09-26  2:57               ` Alexander Holler
2013-09-26  3:04                 ` Al Viro
2013-09-26  3:27                   ` Alexander Holler
2013-09-26  3:48                     ` Al Viro
2013-09-26  4:21                       ` Alexander Holler
2013-09-26  5:53                     ` Julia Lawall
2013-09-26  9:55                       ` Alexander Holler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52420DF1.7060108@ahsoftware.de \
    --to=holler@ahsoftware.de \
    --cc=bhelgaas@google.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.senna@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).