style guide (was Re: any value in a standard for defining bit flags?)

ldoolitt at recycle.lbl.gov ldoolitt at recycle.lbl.gov
Wed Jul 5 22:02:39 UTC 2006


Rob -
On Mon, Jul 03, 2006 at 01:20:57PM -0400, Rob Landley wrote:
> Here's the busybox coding style I actually pay attention to:
> 1) We use tabs for indents.  These tabs are 4 spaces.  Deal with it.

That statement is a smidgen too strong.

1) We use tabs for indents.  Most developers use tabs to mean 4 spaces,
but since we only use tabs at the beginning of lines, almost any
tab-space conversion ratio will keep the code looking sane.

This concept is expanded somewhat in the BusyBox doc/style-guide.txt

BTW, the "This is a block comment." section of that file  uses
slash-t instead of backslash-t to represent tab.  That's a docu-bug.
Patch to fix that, and a couple of other typos, appended.

    - Larry

--- style-guide.txt.orig	2006-06-30 15:42:03.000000000 -0700
+++ style-guide.txt	2006-07-05 14:59:12.000000000 -0700
@@ -51,13 +51,13 @@
 \s\s\s\sif (expr) {\n\tstmt; --ick.) The only exception to this rule is
 multi-line comments that use an asterisk at the beginning of each line, i.e.:
 
-	/t/*
-	/t * This is a block comment.
-	/t * Note that it has multiple lines
-	/t * and that the beginning of each line has a tab plus a space
-	/t * except for the opening '/*' line where the slash
-	/t * is used instead of a space.
-	/t */
+	\t/*
+	\t * This is a block comment.
+	\t * Note that it has multiple lines
+	\t * and that the beginning of each line has a tab plus a space
+	\t * except for the opening '/*' line where the slash
+	\t * is used instead of a space.
+	\t */
 
 Furthermore, The preference is that tabs be set to display at four spaces
 wide, but the beauty of using only tabs (and not spaces) at the beginning of
@@ -234,7 +234,7 @@
 Exceptions:
 
  - Enums, macros, and constant variables are occasionally written in all
-   upper-case with words optionally seperatedy by underscores (i.e. FIFOTYPE,
+   upper-case with words optionally separated by by underscores (i.e. FIFOTYPE,
    ISBLKDEV()).
 
  - Nobody is going to get mad at you for using 'pvar' as the name of a
@@ -619,7 +619,7 @@
 
 Furthermore, you should put a single comment (not necessarily one line, just
 one comment) before the block, rather than commenting each and every line.
-There is an optimal ammount of commenting that a program can have; you can
+There is an optimal amount of commenting that a program can have; you can
 comment too much as well as too little.
 
 A picture is really worth a thousand words here, the following example



More information about the busybox mailing list