Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changes between Initial Version and Version 1 of CStyle

2012-08-09T15:11:07Z (9 years ago)
Martin Decky

copy cstyle standard from the old Drupal page


  • CStyle

    v1 v1  
     1== HelenOS Coding Style Standard ==
     3=== Entity Naming ===
     5 * Names' words shall be separated by underscore "_".
     6 * Types shall be suffixed with "_t".
     7 * Macros shall be upper case.
     9=== Names ===
     11 * Use sensible, descriptive names.
     12 * Only use English names.
     13 * Variables with a large scope should have long names, variables with a small scope can have short names.
     14 * Use name prefixes for identifiers declared in different modules.
     16=== Indentation and Spacing ===
     18 * Do not use spaces for indentation, except for long line wrapping purposes.
     19 * Consider breaking long lines at 80-character boundary. The wrapped line should continue indented four spaces to the right of the original indentation.
     20 * Braces shall follow "K&R Bracing Style".
     21 * Braces shall be indented 1 tab to the right of the starting position of the enclosing statement or declaration.
     22 * Braces without any contents may be placed on the same line.
     23 * Each statement shall be placed on a line on its own.
     24 * All binary arithmetic, bitwise and assignment operators and the ternary conditional operator (?:) shall be surrounded by spaces; the comma operator shall be followed by a space but not preceded; all other operators shall not be used with spaces.
     26=== Comments ===
     28 * Comments shall be written in English.
     29 * Multiline comments begin with "*" on each inner line.
     30 * Use Doxygen style comments for documenting functions.
     31 * All comments shall be placed above the line the comment describes, indented identically.
     32 * Every function shall have a comment that describes its purpose.
     34=== Miscellaneous ===
     36 * New lines are represented by the LF ('\n') character. Do not use CR + LF or CR.