Show
Ignore:
Timestamp:
06/08/09 18:02:55 (16 years ago)
Author:
smidl
Message:

doc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • doc/html/codingrules.html

    r354 r368  
    6161<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"> 
    6262Default 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> 
     63Generally, 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> 
    6464<ul> 
    6565<li> 
    66 <code>`fft_size'</code>  </li> 
     66<code>`FFT_size'</code>  </li> 
    6767<li> 
    68 <code>`nrof_paths'</code>  </li> 
     68<code>`initial_RV'</code>  </li> 
    6969<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> 
    8171</ul> 
    8272<h2><a class="anchor" name="cr_files"> 
    8373Default 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 also written with lower-case letters.<p> 
     74Files 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> 
    8575Source files are named using <code>`.cpp'</code> suffix, whereas header files end with <code>`.h'</code> extension. Examples:<p> 
    8676<ul> 
     
    8878<code>`my_file.h'</code>  </li> 
    8979<li> 
    90 <code>`my_file.cpp'</code>  </li> 
     80<code>`user_info.cpp'</code>  </li> 
    9181</ul> 
    92 <h2><a class="anchor" name="cr_functions"> 
     82<h2><a class="anchor" name="cr_file_templates"> 
     83Form of the source files</a></h2> 
     84For 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> 
     87if 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> 
     90firstly, system headers should be included (i.e. those with brackets `include &lt;header_name&gt;'), 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> 
     93source 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> 
     97Rules 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"> 
    9398Default Naming Rules for Functions</a></h2> 
    9499Function 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> 
     
    106111<h2><a class="anchor" name="cr_classes"> 
    107112Default 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> 
     113Each 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> 
    109114<ul> 
    110115<li> 
    111 <code>`My_Class_Name'</code>  </li> 
     116<code>`MyClassName'</code>  </li> 
    112117<li> 
    113 <code>`My_Struct_Name'</code>  </li> 
     118<code>`MyStructName'</code>  </li> 
    114119<li> 
    115120<code>`OFDM'</code>  </li> 
     
    128133<p> 
    129134Explicit 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:00 2009 for mixpp by&nbsp; 
     135<hr size="1"><address style="text-align: right;"><small>Generated on Mon Jun 8 18:02:34 2009 for mixpp by&nbsp; 
    131136<a href="http://www.doxygen.org/index.html"> 
    132137<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>