Next: Requirements Up: NIL/PIL Coding Guidelines Previous: Introduction

Summary

3
Requirements
    3.1
    Use lint on all source code.
    3.2
    Source files should be less than few hundred lines.
    3.3
    Functions should be less than three screen pages.
    3.4
    Declare functions private or public.
    3.5
    Order functions within files.
    3.6
    Don't use tab characters.
    3.7
    Use 2, 3, or 4 space indent.
    3.8
    Use `{}' consistently.
    3.9
    Use correct case for identifiers.
    3.10
    Do not default functions to int.
    3.11
    Use ``(void)'' where needed.

4
Strong Suggestions
    4.1
    Avoid globals where possible.
    4.2
    Line up continuation lines.
    4.3
    Use #define's instead of numbers.
    4.4
    Avoid ``while( condition );''.
    4.5
    Pass structures by reference.
    4.6
    Comments should be lined up with source code.
    4.7
    Use enumerated types in place of constants.
    4.8
    Use explicit type casting.
    4.9
    Never treat integers as boolean or vice versa.

5
Suggestions

    5.1
    Indent and line up variable and parameter declarations.
    5.2
    Do not overload expressions (``if( (x=y) == 0 )'').
    5.3
    Use for loops only where meaningful.
    5.4
    Declare arguments as pointers or arrays.
    5.5
    Treat arrays as arrays.



Next: Requirements Up: NIL/PIL Coding Guidelines Previous: Introduction


neelin@bic.mni.mcgill.ca
Tue Mar 22 16:51:19 EST 1994