public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Lasse Kärkkäinen / Tronic" <tronic2@sci.fi>
To: linux-kernel@vger.kernel.org
Subject: OT: tabs and spaces
Date: Sun, 18 Jul 2004 00:30:34 +0300	[thread overview]
Message-ID: <40F99A7A.7060405@sci.fi> (raw)

[-- Attachment #1: Type: text/plain, Size: 1302 bytes --]

Hi,

When you write prettyprinters, programmers' editors or anything that 
does some kind of code indentation, please take care of the following rules:

1. NEVER convert N spaces into one tab; they are not equal with any N
2. count spaces and tabs separately (one tab for each { }, etc)
3. if aligning with anything (text, not indent), use spaces only
4. print tab chars at the very beginning of the line, never after any 
other characters

GNU indent and all other prettyprinters I know of violate the first 
three rules. I chose to write LKML because so many people writing 
indenting software, or just writing code, will be reading this now...

If the indentation is done this way, it never breaks with any tab width. 
The only (minor) issue concerns cutting long lines, because you cannot 
know the line length if you don't know tab length.

Before the flamewar begins: I am not saying that tab indentation or 
space indentation is better, just saying that the regular tab 
indentation is not optimal. So far I haven't seen anyone thinking that 
the regular way is better than this one, so there doesn't seem to be any 
debate about that.

If you agree with the above, please spread the message :)

As this is clearly off-topic, it may be better to answer to me only, not 
to the list.

- Tronic -

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

                 reply	other threads:[~2004-07-17 21:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=40F99A7A.7060405@sci.fi \
    --to=tronic2@sci.fi \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox