Date: Tue, 28 May 1996 20:35:53 +1000 From: Bruce Evans <bde@zeta.org.au> To: grog@lemis.de, hackers@freebsd.org Subject: Re: Indentation styles Message-ID: <199605281035.UAA13366@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>First, a question: is there a recommended FreeBSD indentation style? Yes. See style.9 in -current or /usr/src/admin/style/style in 4.4BSD. >Now, my problem: I frequently modify other people's code, which >sometimes causes me problems in reading, simply because the >indentation varies so much from the indentation that my tools and I >use. Frequently, I just give up and run the whole source through >indent(1). The resulting modifications work (usually), but it's >difficult to pass them back to the original author as diffs. Don't use indent on other peoples code. >Therefore, my suggestion: if FreeBSD doesn't have a canonical >indentation style, it should get one. The style should be >reproducible with indent(1). (For those of you who don't know, BSD indent is too broken to produce BSD style :-(. It can only produce an approximation that looks OK but has too many differences for automatic use. >If there is already a recommended FreeBSD indentation style, can it be >reliably produced with indent(1)? If not, what do people think about >modifying it to a (closely similar) form which can be created with >indent(1)? indent(1) should be changed, not the style. Otherwise 200MB of current sources that sort of have the correct style would have the wrong style. >Finally, a restriction. Indent style can, in some cases, influence >coding style: for example, if you choose an indent of 8 and indent >braces 8 characters and the contents of a block another 8 spaces, >you'll soon run out of margins. Even if you only indent a single 8 >characters, you'll end up writing different code from people running >smaller indents. Does this matter? 8 is too much but we're stuck with it. There is something to be said for the discipline required to minimise nesting. Don't right code like this: { { { { { { { { { /* * Com- * men- * ts * are * hard * to * fit * bet- * wee- * n * col- * umns * 72 * and * 80. */ { /*->*/ { /*->*/ /* Some people's xterms are too wide. */ Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605281035.UAA13366>