* OT: tabs and spaces
@ 2004-07-17 21:30 Lasse Kärkkäinen / Tronic
0 siblings, 0 replies; only message in thread
From: Lasse Kärkkäinen / Tronic @ 2004-07-17 21:30 UTC (permalink / raw)
To: linux-kernel
[-- 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 --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-07-17 21:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-17 21:30 OT: tabs and spaces Lasse Kärkkäinen / Tronic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox