root/doc/html/codingrules.html @ 264

Revision 264, 4.4 kB (checked in by smidl, 15 years ago)

doc

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>mixpp: Coding Rules (Mostly inherited from IT++)</title>
4<link href="doxygen.css" rel="stylesheet" type="text/css">
5<link href="tabs.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.6 -->
8<div class="navigation" id="top">
9  <div class="tabs">
10    <ul>
11      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
12      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
13      <li><a href="modules.html"><span>Modules</span></a></li>
14      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
15      <li><a href="classes.html"><span>Classes</span></a></li>
16      <li><a href="files.html"><span>Files</span></a></li>
17    </ul>
18  </div>
19</div>
20<div class="contents">
21<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">
22Default Naming Rules for Variables</a></h2>
23Variables 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>
24<ul>
25<li>
26<code>`fft_size'</code>  </li>
27<li>
28<code>`nrof_paths'</code>  </li>
29<li>
30<code>`my_variable_name'</code>  </li>
31</ul>
32<p>
33Some 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>
34<ul>
35<li>
36<code>`rows'</code> - number of rows in a matrix  </li>
37<li>
38<code>`cols'</code> - number of columns in a matrix  </li>
39<li>
40<code>`nrof_'</code> - number of ...  </li>
41</ul>
42<h2><a class="anchor" name="cr_files">
43Default Naming Rules for Files</a></h2>
44Files 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>
45Source files are named using <code>`.cpp'</code> suffix, whereas header files end with <code>`.h'</code> extension. Examples:<p>
46<ul>
47<li>
48<code>`my_file.h'</code>  </li>
49<li>
50<code>`my_file.cpp'</code>  </li>
51</ul>
52<h2><a class="anchor" name="cr_functions">
53Default Naming Rules for Functions</a></h2>
54Function 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>
55<ul>
56<li>
57<code>int my_function_name(int a, int b)</code>  </li>
58</ul>
59<h2><a class="anchor" name="cr_specialfunctions">
60Convention for sensitive functions</a></h2>
61For efficiency, some functions may return pointers to internal variables. Such functionality is indicated by underscore as the first letter in the the name.<p>
62<ul>
63<li>
64<code>mat* _internal_matrix()</code>  </li>
65</ul>
66<h2><a class="anchor" name="cr_classes">
67Default Naming Rules for Classes and Structures</a></h2>
68Each 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>
69<ul>
70<li>
71<code>`My_Class_Name'</code>  </li>
72<li>
73<code>`My_Struct_Name'</code>  </li>
74<li>
75<code>`OFDM'</code>  </li>
76</ul>
77<h2><a class="anchor" name="cr_classes_functionality">
78Default Functionality of Classes</a></h2>
79All classes that are configured by input parameters should include:<p>
80<ul>
81<li>
82default empty constructor  </li>
83<li>
84one or more additional constructor(s) that takes input parameters and initializes the class instance  </li>
85<li>
86setup function, preferably named <code>`setup'</code> or <code>`set_parameters'</code>  </li>
87</ul>
88<p>
89Explicit 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>
90<hr size="1"><address style="text-align: right;"><small>Generated on Fri Feb 6 19:49:57 2009 for mixpp by&nbsp;
91<a href="http://www.doxygen.org/index.html">
92<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
93</body>
94</html>
Note: See TracBrowser for help on using the browser.