Difference between revisions of "CodeStyleGuide"
From aHuman Wiki
(Automated page entry using MWPush.pl) |
(No difference)
|
Revision as of 01:26, 16 June 2015
Coding Style Guide
@@Home -> CodeStyleGuide
What is The Code Style and Why We Need It
- Code style is the only way to share code
- Good code style helps to develop complex programs
Naming Convention
- use http://en.wikipedia.org/wiki/CamelCase as a direction
- name variables, functions as __varName__, __doSelfDescriptiveAction__
- name classes, typedefs, enums, structs as __!TypeName__
- name constants, defines, as __MAXNAME__
- name files in lower case, as __filename.h__
# name headers by functional area, as __aidb.h__ # name source files by class, use one file per class, as __nnlayer.cpp__
Formatting
- align function body with 8-char tabs
- use spaces to delimit any text, except function name, from brackets and commas
- use spaces before and after '='
- use empty lines to delimit closely related groups of code lines (code block)
- use the doxygen style function header comments.
Comments
- use one-line comments for every code block
- try write comments in such way that they represent sequential specification of function if delete the code
- use area delimiter to split file into groups of functions of very different matter - e.g. header references, interface functions, internal implementation functions, standard interface implementation, such as Object