Skip to content

Commit 30f04ff

Browse files
authored
Update codingrules.adoc
1 parent 9d6c8f1 commit 30f04ff

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

docs/dev/modules/reference/pages/codingrules.adoc

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ public:
172172
173173
private:
174174
//! member
175-
int member;
175+
int M_member;
176+
//! another member
177+
int member_;
176178
};
177179
178180
//! the function
@@ -231,14 +233,16 @@ class MeshAdaptation {};
231233
232234
----
233235

234-
* Non-static data members name of structures and classes always start with `M_` . M stands for Member. The rational behind this is for example :
236+
* Non-static data members name of structures and classes always start with `M_` . M stands for Member, or adding `_` at the end of the member name. The rational behind this is for example :
235237
** to be able to immediately see that the data is a member of a class or a struct
236238
** to easily search and query-replace
237239

238240
[source,cpp]
239241
----
242+
// Wong
243+
class meshAdaptation { std::vector directions; };
240244
241-
// Wrong
245+
// Correct
242246
class meshAdaptation { std::vector directions_; };
243247
244248
// Correct
@@ -252,6 +256,8 @@ class MeshAdaptation { std::vector M_directions; };
252256

253257
[source,cpp]
254258
----
259+
// Wrong
260+
class meshAdaptation { static std::vector directions; };
255261
256262
// Wrong
257263
class meshAdaptation { static std::vector directions_; };
@@ -356,7 +362,19 @@ if (address.isEmpty() || !isValid() || !codec)
356362
{
357363
return false;
358364
}
365+
else
366+
{
367+
return true;
368+
}
359369
370+
371+
// Wrong
372+
if (address.isEmpty() || !isValid() || !codec) {
373+
return false;
374+
}
375+
else {
376+
return truel
377+
}
360378
----
361379

362380
* Exception 2: Use braces also in if-then-else blocks where either the if-code or the else-code covers several lines

0 commit comments

Comments
 (0)