[OpenAFS-devel] coding standards proposal

Nathan Neulinger nneul@umr.edu
22 Jan 2003 21:14:20 -0600


> > 	-ts4 instead of -ts8 (so tabs matches the indent spaces - otherwise,
> > code is unreadable on a edit set with tabstop=4)
> 
> i had this argument with someone. he said the same. most editors are
> configurable. note that -ts8 is the default, so if you don't specify,
> that's what you get, and as i said, i looked at the code we got to pick
> this stuff. ignoring configurable editors that haven't been so configured,
> is there a good reason for this? alternately, have i mischaracterized the
> code base we have? (this is a serious question, not bait)

My main issue with -ts4 vs. -ts8:

       E=8              E=4
ts4    very wide        looks fine
ts8    looks fine       ifs are collapsed

The issue comes in due to the mismatch between -i4 and -ts8. If you make
-i8 as well, I think it will also fix the problem.

In some respects, -i8 -ts8 might be the best bet, as does everything
with tabs, and leaves the choice of formatting to the displaying/editing
app. 

Here's where you get the problem:

<s><s><s><s>if(x)
<tab=8s>y;

with -ts8 and an editor set for ts=4 you see:

    if(x)
    y;

instead of

    if(x)
        y;

As for the code we have, seems like the vast majority is 4 spaces, then
tab on the next level. (assumes 4s = half-tab, 8s = whole-tab)

I guess the important question is - what do most of the people who are
editing the code use for their editors tab size? 8+8 is probably the
most compatible. But I can live with setting editor back to tabstop=8. 

-- Nathan

------------------------------------------------------------
Nathan Neulinger                       EMail:  nneul@umr.edu
University of Missouri - Rolla         Phone: (573) 341-4841
Computing Services                       Fax: (573) 341-4216