Changes between Version 26 and Version 27 of CodingStyle
- Timestamp:
- Aug 1, 2012, 1:37:09 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CodingStyle
v26 v27 21 21 22 22 * Names should be descriptive without being verbose (local variables names may be short). 23 * Class and type names, and #definedsymbols, are all upper case, with underscores to separate words.23 * Class and type names, and `#defined` symbols, are all upper case, with underscores to separate words. 24 24 * Variable and function names are all lower case, with underscores to separate words. 25 25 * No mixed case names. … … 35 35 ); 36 36 }}} 37 * {{{switch}}} statements: {{{case}}} labels are at same indent level as {{{switch}}}:37 * `switch` statements: `case` labels are at same indent level as `switch` 38 38 {{{ 39 39 switch (foo) { … … 136 136 === Includes === #includes 137 137 138 * A `.cpp` file should have the minimum set of #includes to get that particular file to compile (e.g. the includes needed by {{{foo.cpp}}} should be in {{{foo.cpp}}}, not {{{foo.h}}}).139 * foo.cpp should include foo.hfirst; after that, includes should be ordered from general (`<stdio.h>`) to specific (`shmem.h`).138 * A `.cpp` file should have the minimum set of #includes to get that particular file to compile (e.g. the includes needed by `foo.cpp` should be in `foo.cpp`, not `foo.h`). 139 * `foo.cpp` should include `foo.h` first; after that, includes should be ordered from general (`<stdio.h>`) to specific (`shmem.h`). 140 140 141 141 === Extern declarations === #extern 142 142 143 * {{{foo.h}}} should have '{{{extern}}}' declarations for all public functions and variables in {{{foo.cpp}}} There should be no '{{{extern}}}' statements in {{{.cpp}}}files.143 * `foo.h` should have `extern` declarations for all public functions and variables in `foo.cpp` There should be no `extern` statements in `.cpp` files. 144 144 145 145 === Use of static === #static 146 146 147 * If a function or variable is used in only one file, declare it {{{static}}}.147 * If a function or variable is used in only one file, declare it `static`. 148 148 149 149 === Things to avoid unless there's a truly compelling reason: === #try-avoid