Changeset 368 for doc/html/codingrules.html
- Timestamp:
- 06/08/09 18:02:55 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
doc/html/codingrules.html
r354 r368 61 61 <h1><a class="anchor" name="codingrules">Coding Rules (Mostly inherited from IT++) </a></h1>In the following sections we describe the naming conventions which are used for files, classes, structures, local variables, and global variables.<h2><a class="anchor" name="cr_variables"> 62 62 Default Naming Rules for Variables</a></h2> 63 Variables are named using lower-case letters and words are separated using under-score. Abbreviations, when used in variable names, are also written with lower-case letters. Examples:<p>63 Generally, variables are named using lower-case letters and words are separated using under-score. But there are many exceptions, for instance abbreviations or classical matematical notations. Therefore, coding rules for variables are quite free. Examples:<p> 64 64 <ul> 65 65 <li> 66 <code>` fft_size'</code> </li>66 <code>`FFT_size'</code> </li> 67 67 <li> 68 <code>` nrof_paths'</code> </li>68 <code>`initial_RV'</code> </li> 69 69 <li> 70 <code>`my_variable_name'</code> </li> 71 </ul> 72 <p> 73 Some variable names or parts of variable names are commonly used in several different functions and files to denote the same thing. For instance the following common names and prefixes should be used:<p> 74 <ul> 75 <li> 76 <code>`rows'</code> - number of rows in a matrix </li> 77 <li> 78 <code>`cols'</code> - number of columns in a matrix </li> 79 <li> 80 <code>`nrof_'</code> - number of ... </li> 70 <code>`my_variable'</code> </li> 81 71 </ul> 82 72 <h2><a class="anchor" name="cr_files"> 83 73 Default Naming Rules for Files</a></h2> 84 Files are named using lower-case letters and words are separated using under-score. Abbreviations, when used in file names, are alsowritten with lower-case letters.<p>74 Files are named using lower-case letters and words are separated using under-score. If an abbreviation is inevitable within file name, it is written with lower-case letters.<p> 85 75 Source files are named using <code>`.cpp'</code> suffix, whereas header files end with <code>`.h'</code> extension. Examples:<p> 86 76 <ul> … … 88 78 <code>`my_file.h'</code> </li> 89 79 <li> 90 <code>` my_file.cpp'</code> </li>80 <code>`user_info.cpp'</code> </li> 91 81 </ul> 92 <h2><a class="anchor" name="cr_functions"> 82 <h2><a class="anchor" name="cr_file_templates"> 83 Form of the source files</a></h2> 84 For all the library classes, both header file `[filename].h' and source file `[filename].cpp' should be implemented. And the following few rules should be respected<p> 85 <ul> 86 <li> 87 if possible, each `inline ... ' dircetive should be located within the `.h' file, one obvious exception is the case of `inline [filename].h' written in `[filename].cpp' <p> 88 </li> 89 <li> 90 firstly, system headers should be included (i.e. those with brackets `include <header_name>'), other headers (like `include my_header_name.h') should follow (this rule leads to the faster search of an error on some compilators) <p> 91 </li> 92 <li> 93 source code itself should be placed in the `.cpp' file, `.h' should contains only class declarations and documentation (this rule has a few exceptions like inline functions, templates and some extremely short function bodies)<p> 94 </li> 95 </ul> 96 <p> 97 Rules considering formatting of the source code itself are stored in the file , which is a configuration file for code formating utility named ASTYLE. To apply them, download the proper version from its web page <a href="http://astyle.sourceforge.net/">http://astyle.sourceforge.net/</a><h2><a class="anchor" name="cr_functions"> 93 98 Default Naming Rules for Functions</a></h2> 94 99 Function names are named using lower-case letters and words are separated using under-score. Abbreviations, when used in function names, are also written with lower-case letters. This rule applies both to stand-alone functions as well as to member functions of classes. Example:<p> … … 106 111 <h2><a class="anchor" name="cr_classes"> 107 112 Default Naming Rules for Classes and Structures</a></h2> 108 Each new word in a class or structure name should always start with a capital letter and the words should be separated with an under-score. Abbreviations are written with capital letters. Examples:<p>113 Each new word in a class or structure name should always start with a capital letter and the words should not be separated. Abbreviations are written with capital letters. Examples:<p> 109 114 <ul> 110 115 <li> 111 <code>`My _Class_Name'</code> </li>116 <code>`MyClassName'</code> </li> 112 117 <li> 113 <code>`My _Struct_Name'</code> </li>118 <code>`MyStructName'</code> </li> 114 119 <li> 115 120 <code>`OFDM'</code> </li> … … 128 133 <p> 129 134 Explicit destructor functions are not required, unless they are needed. It shall not be possible to use any of the other member functions unless the class has been properly initiated with the input parameters. </div> 130 <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:11:002009 for mixpp by 135 <hr size="1"><address style="text-align: right;"><small>Generated on Mon Jun 8 18:02:34 2009 for mixpp by 131 136 <a href="http://www.doxygen.org/index.html"> 132 137 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>