Difference between revisions of "CodeStyleGuide"
From aHuman Wiki
(Automated page entry using MWPush.pl) |
(Automated page entry using MWPush.pl) |
||
Line 1: | Line 1: | ||
− | |||
<pre style="color: green">Coding Style Guide</pre> | <pre style="color: green">Coding Style Guide</pre> | ||
@@[[Home]] -> [[CodeStyleGuide]] | @@[[Home]] -> [[CodeStyleGuide]] |
Latest revision as of 19:05, 28 November 2018
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