directory re-organization (keeps the old build system)
[novacoin.git] / doc / coding.txt
1 Please be consistent with the existing coding style.\r
2 \r
3 Block style:\r
4 \r
5 bool Function(char* psz, int n)\r
6 {\r
7     // Comment summarising what this section of code does\r
8     for (int i = 0; i < n; i++)\r
9     {\r
10         // When something fails, return early\r
11         if (!Something())\r
12             return false;\r
13         ...\r
14     }\r
15 \r
16     // Success return is usually at the end\r
17     return true;\r
18 }\r
19 \r
20 - ANSI/Allman block style\r
21 - 4 space indenting, no tabs\r
22 - No extra spaces inside parenthesis; please don't do ( this )\r
23 - No space after function names, one space after if, for and while\r
24 \r
25 Variable names begin with the type in lowercase, like nSomeVariable.\r
26 Please don't put the first word of the variable name in lowercase like\r
27 someVariable.\r
28 \r
29 Common types:\r
30 n       integer number: short, unsigned short, int, unsigned int,\r
31             int64, uint64, sometimes char if used as a number\r
32 d       double, float\r
33 f       flag\r
34 hash    uint256\r
35 p       pointer or array, one p for each level of indirection\r
36 psz     pointer to null terminated string\r
37 str     string object\r
38 v       vector or similar list objects\r
39 map     map or multimap\r
40 set     set or multiset\r
41 bn      CBigNum\r