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

Changes between Version 1 and Version 2 of CStyle


Ignore:
Timestamp:
2012-08-09T15:39:10Z (7 years ago)
Author:
Jiri Svoboda
Comment:

More on bracing, Yoda comparison

Legend:

Unmodified
Added
Removed
Modified
  • CStyle

    v1 v2  
    1818 * Do not use spaces for indentation, except for long line wrapping purposes.
    1919 * 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.
     20 * Each statement shall be placed on a line on its own.
     21 * Braces shall follow [http://en.wikipedia.org/wiki/Indent_style#K.26R_style K&R Bracing Style]
     22   * I.e. for functions the opening braces starts at a new line
     23 * Blocks within braces shall be indented 1 tab to the right as compared to the enclosing braces
    2224 * Braces without any contents may be placed on the same line.
    23  * Each statement shall be placed on a line on its own.
     25 * Blocks containing a single statement can omit braces
     26   * For if...else statements both or neither of the T, F blocks must be delimited by braces
    2427 * 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.
    2528
     
    3538
    3639 * New lines are represented by the LF ('\n') character. Do not use CR + LF or CR.
     40 * Do *not* use Yoda comparisons (e.g. NULL == ptr)