Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorKirill Zhdanovich <kzhdanovich@gmail.com>2013-03-28 20:17:43 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:52:30 +0300
commit612c7ec5c067611d986299f381a8f1ebddfd439a (patch)
treeb9b8532f97e671ae6ffe65a8723525641b470196 /docs
parentd0ab5cd9d3239b358bc74c36ffbebcb61d8c68ba (diff)
[Code Style] Spaces after keyword and space between operators
Diffstat (limited to 'docs')
-rw-r--r--docs/cpp_coding_standard.txt33
1 files changed, 32 insertions, 1 deletions
diff --git a/docs/cpp_coding_standard.txt b/docs/cpp_coding_standard.txt
index c74e167e76..434b37fe71 100644
--- a/docs/cpp_coding_standard.txt
+++ b/docs/cpp_coding_standard.txt
@@ -20,6 +20,9 @@ Naming and formatting
- Don't specify std:: and boost:: prefixes (headers in std/ folder already have 'using std::string')
- Use right-to-left order for variables/params: string const & s (reference to the const string)
- In one line 'if', 'for', 'while' we do not use brackets. If one line 'for' or 'while' is combined with one line 'if' do use brackets for cycle.
+- Space after the keyword in conditions and loops. Space after ';' in for loop
+- Space between binary operators, but can skip according to operators priority: x = y*y + z*z;
+- Space after double dash
// *********** Formatting Example ***********
#include "../std/math.hpp"
@@ -118,12 +121,40 @@ for (size_t i = 0; i < size; ++i)
foo(i);
-while(true)
+while (true)
{
if (condition)
break;
}
+// Space after the keyword
+
+if (condition)
+{}
+
+for (size_t i = 0; i < 5; ++i)
+{}
+
+while (condition)
+{}
+
+switch (i)
+{}
+
+// Space between operators, and don't use space between unary operator and expression
+x = 0;
+x = -5;
+++x;
+x--;
+x *= 5;
+if (x && !y)
+{}
+v = w * x + y / z;
+v = w*x + y/z;
+v = w * (x + z);
+
+// space after double dash
+
Tips and Hints