Style: C programming style usage for the SAN Kit

Revised: 1994.02.19

1) Full and strict ANSI C checking.

2) Uniform tabulation every four columns, useful for complex C programs.

3) Reasonable maximum line length less than eighty characters.

4) No spaces or tabs immediately prior to a newline character.

5) No spaces immediately prior to a tab character.

6) Maximum of one statement per line.

7) Statement indentation, one additional tab character per level.

8) Vertical alignment of brace pair members.

9) Exactly one return statement per function.

10) Each return statement always appears at bottom of its function.

11) No "goto" statements.

12) No "continue" statements.

13) No "break" statements outside of case bodies.

14) Exactly one "break" statement at the end of each case body.

15) Every "switch" statement has a default case body as the last body.

16) Avoidance of implicit typing for function formal parameters.

17) Avoidance of implicit typing for function return values.

18) For each ".c" file, prototypes appear in a separate ".h" file.

19) Each function starts with an easily located stylized format.

20) Function name scope explicitly declared in all cases.

21) No empty control subparts in "for" statements.

22) Long expression lines break after an operator and before an operand.

23) Relational expressions are parethesized if used with "&&" or "||".

24) Arithmetic expressions are parethesized if used with "&&" or "||".

25) File scope variables are all declared with "static" attribute.

26) Native types are covered with typedef constructs for portability.

27) "struct" and "union" declarations are covered inside of typedefs.

28) Preprocessor constant length/limit names all end with "L".

29) Preprocessor constant shift width names all end with "W".

30) Preprocessor constant bitfield mask names all end with "M".

31) Preprocessor constant base two log names all end with "Q".

32) Struct names all end with "S".

33) Union names all end with "U".

34) Typedef names all end with "T".

35) Pointer typedef names all end with "ptrT".

36) Struct member names formed with parent name as a prefix.

36) Avoidance of host/target machine hardware idiosycratic behavior.

37) Avoidance of host/target machine software idiosycratic behavior.

Style: EOF
