|
| 1 | +Style Guide & Coding Conventions |
| 2 | +================================ |
| 3 | +- Indentation is to be consistently four spaces, not tabs or a mixture of spaces and tabs. |
| 4 | +- All files are to have a single blank line at their end, if possible. |
| 5 | +- Prefer C++11 features to C++03 features when possible, and avoid deprecated language features. |
| 6 | +- Prefer use of `class` to `struct` for declaring classes (this means you need to explicitly specify public inheritance). |
| 7 | +- Prefer to use file extensions .cpp and .hpp to aid in GitHub's language recognition algorithms (using .h may cause the file to be detected as C rather than C++) |
| 8 | +- Prefer `lowercase` namespace, parameter, and local variable names. |
| 9 | +- Prefer `UpperCamelCase` class and member function names |
| 10 | +- Prefer `lower_case_underscore` private member names |
| 11 | +- Avoid using raw pointers when possible |
| 12 | +- Prefer creating `using` declarations to using raw primitive types |
| 13 | +- Avoid use of exceptions when possible |
| 14 | +- Avoid ambiguous or non-obvious public interfaces that would otherwise require documentation |
| 15 | +- Prefer code that makes less assumptions and allows more flexibility to client code |
| 16 | +- Prefer using e.g. functions defined in `<algorithm>` to using common idioms - this allows refactoring to be more obvious and/or straightforward |
| 17 | +- First design abstract/high-level/object-oriented code, and optimize later as needed |
| 18 | +- Use nameless scopes in functions to emphasize the lifetime of RAII objects |
| 19 | +- Place source file helper functions/classes in anonymous namespaces AND declare them static, so as to avoid name/symbol conflicts across irrelevant source files |
| 20 | +- Keep clear the separation between client and server behaviors and responsibilities |
| 21 | + |
| 22 | +To suggest changes to this guide, fork the project, make amendments, submit the pull request, and partake in discussion of the changes. |
0 commit comments