The purpose of this patch is to propose and discuss the coding style for the Bitcoin Core source code.
The main idea of this approach is:
- Love spaces
- Love newlines '\n'
- Love empty lines to delimit the code parts
- Put curly braces everywhere and always on the new line
I believe that this approach produce the code that is especially easy to read and understand for the non-pro person diving into the world of Bitcoin.
The 'uncrustify' 0.59 tool was used to fix the coding style (from official Ubuntu 14.04 repo).
The command used to process the files:
find . -iname "*.h" -o -iname "*.cc" -o -iname "*.cpp" | sort | grep -v "src\/leveldb\/" | grep -v "src\/json\/" | grep -v "src\/qt\/" | grep -v "src\/test\/" | xargs -I '{}' uncrustify -c .uncrustify.cfg --no-backup --replace '{}'
- UniversalIndentGUI program may be used to try and test the coding style easily
- 'uncrustify' does not support partial files
(as
git clang-formatdoes, at least I'm not aware of one)