Browse Source

update coding.md to reflect changes by pull

- also mention alphabetical include ordering
0.10
Philip Kaufmann 10 years ago
parent
commit
86fe1b864b
  1. 25
      doc/coding.md

25
doc/coding.md

@ -4,7 +4,7 @@ Coding @@ -4,7 +4,7 @@ Coding
Please be consistent with the existing coding style.
Block style:
```c++
bool Function(char* psz, int n)
{
// Comment summarising what this section of code does
@ -19,12 +19,33 @@ Block style: @@ -19,12 +19,33 @@ Block style:
// Success return is usually at the end
return true;
}
```
- ANSI/Allman block style
- 4 space indenting, no tabs
- No extra spaces inside parenthesis; please don't do ( this )
- No space after function names, one space after if, for and while
- Includes need to be ordered alphabetically, separate own and foreign headers with a new-line (example key.cpp):
```c++
#include "key.h"
#include "crypto/sha2.h"
#include "util.h"
#include <openssl/foo.h>
```
- Class or struct keywords in header files need to be ordered alphabetically:
```c++
class CAlpha;
class CBeta;
```
- When using namespace keyword use the following form:
```c++
namespace Foo {
...
} // Foo
```
Variable names begin with the type in lowercase, like nSomeVariable.
Please don't put the first word of the variable name in lowercase like
someVariable.

Loading…
Cancel
Save