1 | In the following sections we describe the naming conventions which are used for files, classes, structures, local variables, and global variables.\section{Default Naming Rules for Variables}\label{codingrules_cr_variables} |
---|
2 | 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: |
---|
3 | |
---|
4 | \begin{itemize} |
---|
5 | \item {\tt `fft\_\-size'} \item {\tt `nrof\_\-paths'} \item {\tt `my\_\-variable\_\-name'} \end{itemize} |
---|
6 | |
---|
7 | |
---|
8 | 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: |
---|
9 | |
---|
10 | \begin{itemize} |
---|
11 | \item {\tt `rows'} - number of rows in a matrix \item {\tt `cols'} - number of columns in a matrix \item {\tt `nrof\_\-'} - number of ... \end{itemize} |
---|
12 | \section{Default Naming Rules for Files}\label{codingrules_cr_files} |
---|
13 | 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. |
---|
14 | |
---|
15 | Source files are named using {\tt `.cpp'} suffix, whereas header files end with {\tt `.h'} extension. Examples: |
---|
16 | |
---|
17 | \begin{itemize} |
---|
18 | \item {\tt `my\_\-file.h'} \item {\tt `my\_\-file.cpp'} \end{itemize} |
---|
19 | \section{Default Naming Rules for Functions}\label{codingrules_cr_functions} |
---|
20 | 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: |
---|
21 | |
---|
22 | \begin{itemize} |
---|
23 | \item {\tt int my\_\-function\_\-name(int a, int b)} \end{itemize} |
---|
24 | \section{Convention for sensitive functions}\label{codingrules_cr_specialfunctions} |
---|
25 | For efficiency, some functions may return pointers to internal variables. Such functionality is indicated by underscore as the first letter in the the name. |
---|
26 | |
---|
27 | \begin{itemize} |
---|
28 | \item {\tt mat$\ast$ \_\-internal\_\-matrix()} \end{itemize} |
---|
29 | \section{Default Naming Rules for Classes and Structures}\label{codingrules_cr_classes} |
---|
30 | 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: |
---|
31 | |
---|
32 | \begin{itemize} |
---|
33 | \item {\tt `My\_\-Class\_\-Name'} \item {\tt `My\_\-Struct\_\-Name'} \item {\tt `OFDM'} \end{itemize} |
---|
34 | \section{Default Functionality of Classes}\label{codingrules_cr_classes_functionality} |
---|
35 | All classes that are configured by input parameters should include: |
---|
36 | |
---|
37 | \begin{itemize} |
---|
38 | \item default empty constructor \item one or more additional constructor(s) that takes input parameters and initializes the class instance \item setup function, preferably named {\tt `setup'} or {\tt `set\_\-parameters'} \end{itemize} |
---|
39 | |
---|
40 | |
---|
41 | 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. |
---|