aboutsummaryrefslogtreecommitdiff
path: root/doc/coding.txt
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-07-15 15:12:01 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-07-15 15:12:17 +0200
commit19366be186a9a2efff1e6abfe8db59cd9f5f5843 (patch)
tree3abb4adeab1a4e86a08bb5bfe61dedf8be178a1c /doc/coding.txt
parent249c6818f171b75930736872d61b0cdcda7e9832 (diff)
parenta35ee9633690fbadc001b2d8fe1dd3ebb852dc25 (diff)
downloadbitcoin-19366be186a9a2efff1e6abfe8db59cd9f5f5843.tar.xz
Merge remote-tracking branch 'satoshi/qtui'
Conflicts (resolved by copying files from remote branch): .gitignore src/cryptopp/cpu.cpp src/cryptopp/cpu.h src/cryptopp/cryptlib.h src/cryptopp/iterhash.h src/cryptopp/misc.h src/cryptopp/secblock.h src/cryptopp/sha.cpp src/cryptopp/sha.h src/cryptopp/smartptr.h src/json/json_spirit_reader.cpp src/json/json_spirit_value.cpp src/json/json_spirit_writer.cpp
Diffstat (limited to 'doc/coding.txt')
-rw-r--r--doc/coding.txt41
1 files changed, 41 insertions, 0 deletions
diff --git a/doc/coding.txt b/doc/coding.txt
new file mode 100644
index 0000000000..4707476697
--- /dev/null
+++ b/doc/coding.txt
@@ -0,0 +1,41 @@
+Please be consistent with the existing coding style.
+
+Block style:
+
+bool Function(char* psz, int n)
+{
+ // Comment summarising what this section of code does
+ for (int i = 0; i < n; i++)
+ {
+ // When something fails, return early
+ if (!Something())
+ return false;
+ ...
+ }
+
+ // 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
+
+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.
+
+Common types:
+n integer number: short, unsigned short, int, unsigned int,
+ int64, uint64, sometimes char if used as a number
+d double, float
+f flag
+hash uint256
+p pointer or array, one p for each level of indirection
+psz pointer to null terminated string
+str string object
+v vector or similar list objects
+map map or multimap
+set set or multiset
+bn CBigNum