Subject: Re: On Tabs and Spaces

From: "Shawn O. Pearce" <[email-masked]>
Date: Tue, 16 Oct 2007 03:04:21 -0400

Michael Witten <[email-masked]> wrote:
> What are the rules about tabs and spaces in source code?
> 
> I'm having a terrible time with formatting,
> especially in the perl scripts; there is a
> mix of spaces and tabs.
> 
> from what I can deduce, single tabs are used
> to introduce the equivalent of 8 spaces while
> 4 explicit spaces are used for half a tab.

The C code is all tabs, with the tabs set at 8 spaces, but the
actual tab width isn't too important here as we never use the tab
for alignment beyond the left indent.

The bulk of the Perl/shell is also done that way, but you may
run into a place where it isn't.  In which case try to match the
existing identation within that block as best as you can so the diff
is minimal and the resulting file still indents just as good/bad
as it did before.

You may also consider submitting a whitespace correction patch in
front of your actual code change to correct the offending part of
the file, but every line you touch is that much more work for your
peers to review and test.  In short changing code is bad unless
there is a really compelling reason...

-- 
Shawn.