All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: Chris Snook <csnook@redhat.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: Coding Style: indenting with tabs vs. spaces
Date: Mon, 12 Nov 2007 10:17:55 +0200	[thread overview]
Message-ID: <47380C33.8010103@panasas.com> (raw)
In-Reply-To: <4733323D.4070309@redhat.com>

On Nov. 08, 2007, 17:58 +0200, Chris Snook <csnook@redhat.com> wrote:
> Benny Halevy wrote:
>> Greetings,
>>
>> I would like to hear peoples opinion about the indentation convention
>> described below that I personally found the most practical with
>> several different editors.
>>
>> The gist of it is that tabs should be used for nesting, not for decoration.
>> Indent your code with as many tabs as your nesting level, where all statements
>> will begin, and from there on use space characters.
>> The rational behind it is to be tab-width agnostic so regardless of your
>> tab expansion setup, the code will look correct and will make sense.
>>
>> When you break a line and want the new line text to start below a specific point
>> relative to the previous line (I consider that "decorating") then start the new
>> line with the same number of tabs as the previous one and then just use space
>> characters as their width is the same as any character in the previous line,
>> (assuming fixed-width fonts of course).
> 
> I find it meaningful to indent extended lines one extra tab stop, but beyond 
> that I agree it is just decoration.

Yup, that's a valid convention, as long as there are no trailing spaces after that
extra tab stop.  Concatenating spaces to this one extra tab stop (as checkpatch
allows for up to 7 spaces) for decoration works well just as long as everybody
expand tabs the same way.

Benny

> 
> 	-- Chris
> -


  reply	other threads:[~2007-11-12  8:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-08 10:36 Coding Style: indenting with tabs vs. spaces Benny Halevy
2007-11-08 15:58 ` Chris Snook
2007-11-12  8:17   ` Benny Halevy [this message]
2007-11-10 12:04 ` DervishD
2007-11-10 12:27   ` Xavier Bestel
2007-11-10 16:50     ` DervishD
2007-11-11  9:23       ` James Courtier-Dutton
2007-11-12  8:13         ` Benny Halevy
2007-11-12 15:38           ` J. Bruce Fields
2007-11-12 16:30           ` DervishD
2007-11-11  8:57     ` Benny Halevy

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=47380C33.8010103@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=csnook@redhat.com \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.