... | ... | @@ -7,46 +7,39 @@ |
|
|
```
|
|
|
|
|
|
2. <strong>Naming:</strong> Use meaningful English words, well-known acronyms (MPI, XML, CFD, GMRES, etc.), or well-known short names (Config, Comm, 2D, 3D).
|
|
|
<ul>
|
|
|
<li>Examples: <strong>initialTime</strong> instead of <strong>tIni</strong> , or <strong>work</strong> instead of <strong>wrk</strong> </li>
|
|
|
<li>One Exception: when redefining long types with the <strong>using</strong> keyword reasonable mnemonics and short names are allowed, always document scope.
|
|
|
|
|
|
* Examples: <strong>initialTime</strong> instead of <strong>tIni</strong> , or <strong>work</strong> instead of <strong>wrk</strong> </li>
|
|
|
* One Exception: when redefining long types with the <strong>using</strong> keyword reasonable mnemonics and short names are allowed, always document scope.
|
|
|
|
|
|
```cpp
|
|
|
// local 2D Vector of doubles
|
|
|
using std::vector<std::vector<double>> = vDouble2D;
|
|
|
```
|
|
|
</li>
|
|
|
</ul>
|
|
|
```cpp
|
|
|
// local 2D Vector of doubles
|
|
|
using std::vector<std::vector<double>> = vDouble2D;
|
|
|
```
|
|
|
|
|
|
3. <strong>Avoid underscores:</strong> adds unnecessary length. Reserve it for prefixes of special cases (see class members and lambda functions). Use upper case letters instead.
|
|
|
|
|
|
** Don't
|
|
|
* Don't
|
|
|
|
|
|
```cpp
|
|
|
std::vector<std::vector<<double>> this_is_my_very_very_long_two_dimensional_vector_name;
|
|
|
```
|
|
|
|
|
|
** Do
|
|
|
* Do
|
|
|
|
|
|
```cpp
|
|
|
std::vector<std::vector<<double>> thisIsMyVeryVeryLongTwoDimensionalVectorName;
|
|
|
```
|
|
|
|
|
|
</li>
|
|
|
|
|
|
4. <strong>Using and typedef keywords:</strong> Prefer the keyword <strong>using</strong> over <strong>typedef</strong> for readability. Only rename very long complex or custom types, do not rename standard types ( int , double , std::vector ). Prefer including ADIOSTypes.h as it contains fixed types in the std:: namespace uint8_t, uint64_t .
|
|
|
<ul>
|
|
|
<li> Don't
|
|
|
4. <strong>Using and typedef keywords:</strong> Prefer the keyword <strong>using</strong> over <strong>typedef</strong> for readability. Only rename very long complex or custom types, do not rename standard types (int, double, std::vector<double>). Prefer including ADIOSTypes.h as it contains fixed types in the std:: namespace uint8_t, uint64_t .
|
|
|
|
|
|
* Don't
|
|
|
|
|
|
```cpp
|
|
|
typedef std::vector<std::vector<std::map<std::string, double>>> MapIn2DVector;
|
|
|
```
|
|
|
</li>
|
|
|
<li> Do
|
|
|
|
|
|
* Do
|
|
|
|
|
|
```cpp
|
|
|
using std::vector<std::vector<std::map<std::string, double>>> = MapIn2DVector;
|
|
|
```
|
|
|
</li>
|
|
|
</ul>
|
|
|
|
|
|
``` |
|
|
\ No newline at end of file |