aboutsummaryrefslogtreecommitdiffstats
path: root/CODING_STYLE.md
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-19 16:36:04 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-04-19 22:45:16 +0800
commit89c0f481941dfe22c77281f916865f00f8807810 (patch)
tree1d2f25004eae6d871733cf17ce02d5aadbb1a19c /CODING_STYLE.md
parent2546a274ca4ea8cae221945a88f2f069c09180b0 (diff)
downloaddexon-solidity-89c0f481941dfe22c77281f916865f00f8807810.tar.gz
dexon-solidity-89c0f481941dfe22c77281f916865f00f8807810.tar.zst
dexon-solidity-89c0f481941dfe22c77281f916865f00f8807810.zip
Clarify namespaces in coding style.
Diffstat (limited to 'CODING_STYLE.md')
-rw-r--r--CODING_STYLE.md19
1 files changed, 13 insertions, 6 deletions
diff --git a/CODING_STYLE.md b/CODING_STYLE.md
index 3244466b..f36503d0 100644
--- a/CODING_STYLE.md
+++ b/CODING_STYLE.md
@@ -49,21 +49,28 @@ cout << "some very long string that contains completely irrelevant text that tal
## 1. Namespaces
1. No `using namespace` declarations in header files.
-2. All symbols should be declared in a namespace except for final applications.
-3. Use anonymous namespaces for helpers whose scope is a cpp file only.
-4. Preprocessor symbols should be prefixed with the namespace in all-caps and an underscore.
+2. Use `using namespace std;` in cpp files, but avoid importing namespaces from boost and others.
+3. All symbols should be declared in a namespace except for final applications.
+4. Use anonymous namespaces for helpers whose scope is a cpp file only.
+5. Preprocessor symbols should be prefixed with the namespace in all-caps and an underscore.
-Yes:
+Only in the header:
```cpp
#include <cassert>
+namespace myNamespace
+{
std::tuple<float, float> meanAndSigma(std::vector<float> const& _v);
+}
```
-No:
+Only in the cpp file:
```cpp
#include <cassert>
using namespace std;
-tuple<float, float> meanAndSigma(vector<float> const& _v);
+tuple<float, float> myNamespace::meanAndSigma(vector<float> const& _v)
+{
+ // ...
+}
```
## 2. Preprocessor