public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Tomer Barletz <barletz@gmail.com>,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: tj@kernel.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sata_sx4: Check return code from pdc20621_i2c_read()
Date: Mon, 03 Aug 2015 12:09:21 -0700	[thread overview]
Message-ID: <1438628961.4601.2.camel@perches.com> (raw)
In-Reply-To: <CAO-S75BnJJvNsEN3xFrtO9xO=4=UnwJeL6UHLeMbOaSyjk4Htw@mail.gmail.com>

On Mon, 2015-08-03 at 12:04 -0700, Tomer Barletz wrote:
> I see how it makes sense to add a tab to align with the previous line
> of code, as it will always look similar in all editors, no matter how
> their tab character is set up to be.
> However, adding more tabs will just mess up editors that are not set
> up with 8-space width tabs.
> 
> Is this a bug in checkpatch.pl, or are we saying everyone should have
> their editor set to 8-spaces width tabs?

from Documentation/CodingStyle:

		Chapter 1: Indentation

Tabs are 8 characters, and thus indentations are also 8 characters.
There are heretic movements that try to make indentations 4 (or even 2!)
characters deep, and that is akin to trying to define the value of PI to
be 3.

Rationale: The whole idea behind indentation is to clearly define where
a block of control starts and ends.  Especially when you've been looking
at your screen for 20 straight hours, you'll find it a lot easier to see
how the indentation works if you have large indentations.

Now, some people will claim that having 8-character indentations makes
the code move too far to the right, and makes it hard to read on a
80-character terminal screen.  The answer to that is that if you need
more than 3 levels of indentation, you're screwed anyway, and should fix
your program.

In short, 8-char indents make things easier to read, and have the added
benefit of warning you when you're nesting your functions too deep.
Heed that warning.


  reply	other threads:[~2015-08-03 19:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-02 10:12 [PATCH] Check return code from pdc20621_i2c_read() Tomer Barletz
2015-08-02 11:09 ` Sergei Shtylyov
     [not found]   ` <CAO-S75CRyh=FPbeTJMZWiYTvpd_wn57f4eGQgOHW2p16+9ANhQ@mail.gmail.com>
2015-08-02 17:55     ` Tomer Barletz
2015-08-02 18:03       ` Joe Perches
2015-08-02 20:22       ` Joe Perches
2015-08-03 15:42       ` Sergei Shtylyov
2015-08-03 15:52         ` Sergei Shtylyov
2015-08-03 18:46           ` [PATCH] sata_sx4: " Tomer Barletz
2015-08-03 18:52             ` Sergei Shtylyov
2015-08-03 19:04               ` Tomer Barletz
2015-08-03 19:09                 ` Joe Perches [this message]
2015-08-03 19:19                 ` Sergei Shtylyov
2015-08-03 19:18               ` Tomer Barletz
2015-08-06 16:40                 ` Tejun Heo
2015-08-03  6:06     ` [PATCH] " Tomer Barletz
2015-08-03 15:40       ` Sergei Shtylyov

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=1438628961.4601.2.camel@perches.com \
    --to=joe@perches.com \
    --cc=barletz@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=tj@kernel.org \
    /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