You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/dev/modules/reference/pages/codingrules.adoc
+21-3Lines changed: 21 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -172,7 +172,9 @@ public:
172
172
173
173
private:
174
174
//! member
175
-
int member;
175
+
int M_member;
176
+
//! another member
177
+
int member_;
176
178
};
177
179
178
180
//! the function
@@ -231,14 +233,16 @@ class MeshAdaptation {};
231
233
232
234
----
233
235
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 :
235
237
** to be able to immediately see that the data is a member of a class or a struct
236
238
** to easily search and query-replace
237
239
238
240
[source,cpp]
239
241
----
242
+
// Wong
243
+
class meshAdaptation { std::vector directions; };
240
244
241
-
// Wrong
245
+
// Correct
242
246
class meshAdaptation { std::vector directions_; };
243
247
244
248
// Correct
@@ -252,6 +256,8 @@ class MeshAdaptation { std::vector M_directions; };
252
256
253
257
[source,cpp]
254
258
----
259
+
// Wrong
260
+
class meshAdaptation { static std::vector directions; };
255
261
256
262
// Wrong
257
263
class meshAdaptation { static std::vector directions_; };
@@ -356,7 +362,19 @@ if (address.isEmpty() || !isValid() || !codec)
356
362
{
357
363
return false;
358
364
}
365
+
else
366
+
{
367
+
return true;
368
+
}
359
369
370
+
371
+
// Wrong
372
+
if (address.isEmpty() || !isValid() || !codec) {
373
+
return false;
374
+
}
375
+
else {
376
+
return truel
377
+
}
360
378
----
361
379
362
380
* 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