Coding style

Matthias Urlichs smurf at noris.de
Wed Sep 8 05:08:49 UTC 1999


Hi,

Russ Allbery:
> > I think we/you should just pick a fairly standard setting of 'indent'
> > and run the whole thing through it.  That way there is no problem for
> > anyone trying to replicate the style in all its details.
> 
> I'd be happy to detabify the entire source at some point, but doing things
> like that tends to result in merge conflicts from hell so they're not to
> be done lightly....
> 
IMHO, I'd rather have the source wholly _tab_ified. That way, people can
choose for themselves how far to indent everything and there won't be merge
problems for everybody.

The Linux coding standards document has this to say on the topic, and FWIW
I agree wholeheartedly:

>         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. 
> 

-- 
Matthias Urlichs  |  noris network GmbH   |   smurf at noris.de  |  ICQ: 20193661
The quote was selected randomly. Really.    |      http://www.noris.de/~smurf/
-- 
Every man has a right to his opinion, but no man has a right to be wrong
in his facts.
                                -- Bernard M. Baruch


More information about the inn-workers mailing list