aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorksooo <3226626+ksooo@users.noreply.github.com>2023-10-26 11:36:55 +0200
committerksooo <3226626+ksooo@users.noreply.github.com>2023-10-26 11:36:55 +0200
commit35db1dc99be09d89bb3f07118e52fe5404748cc9 (patch)
tree24ada77c82bf05f12277a2f90e1412b824865f49 /docs
parentb29d4d26b2a602659748b051308fa7b9f3f439b8 (diff)
[docs] Coding guideline: Add, that we are using prefix operators in traditional for loop's increment statement.
Diffstat (limited to 'docs')
-rw-r--r--docs/CODE_GUIDELINES.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/CODE_GUIDELINES.md b/docs/CODE_GUIDELINES.md
index 1af839e6a4..25d64574e4 100644
--- a/docs/CODE_GUIDELINES.md
+++ b/docs/CODE_GUIDELINES.md
@@ -821,6 +821,25 @@ for (const auto& : var)
```
Remove `const` if the value has to be modified. Do not use references to fundamental types that are not modified.
+In traditional for loops, for the `increment statement` of the loop, use prefix increment/decrement operator, not postfix.
+
+✅ Good:
+```cpp
+[...]
+for (int i = 0; i < 100; ++i)
+{
+ [...]
+}
+```
+
+❌ Bad:
+```cpp
+for (int i = 0; i < 100; i++)
+{
+ [...]
+}
+```
+
### 12.6. Include guards
Use `#pragma once`.