Changeset 357 for doc/local/codingrules.dox
- Timestamp:
- 06/08/09 02:15:30 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
doc/local/codingrules.dox
r33 r357 8 8 \section cr_variables Default Naming Rules for Variables 9 9 10 Variables are named using lower-case letters and words are separated 11 u sing under-score. Abbreviations, when used in variable names, are also12 written with lower-case letters. Examples:10 Generally, variables are named using lower-case letters and words are separated using 11 under-score. But there are many exceptions, for instance abbreviations or classical 12 matematical notations. Therefore, coding rules for variables are quite free. Examples: 13 13 14 14 <ul> 15 <li> \c ` fft_size' </li>16 <li> \c ` nrof_paths' </li>17 <li> \c `my_variable _name' </li>15 <li> \c `FFT_size' </li> 16 <li> \c `initial_RV' </li> 17 <li> \c `my_variable' </li> 18 18 </ul> 19 20 Some variable names or parts of variable names are commonly used in21 several different functions and files to denote the same thing. For22 instance the following common names and prefixes should be used:23 24 <ul>25 <li> \c `rows' - number of rows in a matrix </li>26 <li> \c `cols' - number of columns in a matrix </li>27 <li> \c `nrof_' - number of ... </li>28 </ul>29 30 19 31 20 \section cr_files Default Naming Rules for Files 32 21 33 22 Files are named using lower-case letters and words are separated using 34 under-score. Abbreviations, when used in file names, are also written35 with lower-case letters. 23 under-score. If an abbreviation is inevitable within file name, it is written with 24 lower-case letters. 36 25 37 26 Source files are named using <tt>`.cpp'</tt> suffix, whereas header … … 40 29 <ul> 41 30 <li> <tt>`my_file.h'</tt> </li> 42 <li> <tt>` my_file.cpp'</tt> </li>31 <li> <tt>`user_info.cpp'</tt> </li> 43 32 </ul> 44 33 34 \section cr_file_templates Form of the source files 35 36 For all the library classes, both header file `[filename].h' and source file 37 `[filename].cpp' should be implemented. And the following few rules should be 38 respected 39 40 <ul> 41 42 <li> if possible, each `#inline ... ' dircetive should be located within the `.h' 43 file, one obvious exception is the case of `#inline [filename].h' written in 44 `[filename].cpp' </li> 45 46 <li> firstly, system headers should be included (i.e. those with brackets 47 `#include <header_name>'), other headers (like `#include my_header_name.h') 48 should follow (this rule leads to the faster search of an error on some 49 compilators) </li> 50 51 <li> source code itself should be placed in the `.cpp' file, `.h' should 52 contains only class declarations and documentation (this rule has a few exceptions like 53 inline functions, templates and some extremely short function bodies)</li> 54 55 </ul> 56 57 Rules considering formatting of the source code itself are stored in the 58 file \system\astylerc, which is a configuration file for code formating 59 utility named ASTYLE. To apply them, download the proper version from 60 its web page http://astyle.sourceforge.net/ 45 61 46 62 \section cr_functions Default Naming Rules for Functions … … 71 87 72 88 Each new word in a class or structure name should always start with a 73 capital letter and the words should be separated with an74 under-score. Abbreviations arewritten with capital letters. Examples:89 capital letter and the words should not be separated. Abbreviations are 90 written with capital letters. Examples: 75 91 76 92 <ul> 77 <li> \c `My _Class_Name' </li>78 <li> \c `My_Struct_Name' </li>93 <li> \c `MyClassName' </li> 94 <li> \c `MyStructName' </li> 79 95 <li> \c `OFDM' </li> 80 96 </ul>