Skip to content

Commit

Permalink
Merge pull request #14394 from ethereum/purge-using-namespace-std
Browse files Browse the repository at this point in the history
Purge using namespace std in libevmasm
  • Loading branch information
ekpyron authored Jul 10, 2023
2 parents 27faacb + a9c8b4b commit b84af3f
Show file tree
Hide file tree
Showing 19 changed files with 255 additions and 282 deletions.
20 changes: 5 additions & 15 deletions CODING_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ To set indentation and tab width settings uniformly, the repository contains an
## 1. Namespaces
1. No `using namespace` declarations in header files.
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.
6. Do not use `std::` qualifier in cpp files (see 2.), except for `std::move` and `std::forward`, which will otherwise cause the `check_style` step to fail.
2. `using namespace solidity;` and other project local namespaces is fine in cpp files, and generally encouraged.
3. Avoid `using namespace` at file level for third party libraries, such as boost, ranges, etc.
4. All symbols should be declared in a namespace except for final applications.
5. Use anonymous namespaces for helpers whose scope is a cpp file only.
6. Preprocessor symbols should be prefixed with the namespace in all-caps and an underscore.
Only in the header:
```cpp
Expand All @@ -66,16 +66,6 @@ std::tuple<float, float> meanAndSigma(std::vector<float> const& _v);
}
```

Only in the cpp file:
```cpp
#include <cassert>
using namespace std;
tuple<float, float> myNamespace::meanAndSigma(vector<float> const& _v)
{
// ...
}
```
## 2. Preprocessor

1. File comment is always at top, and includes:
Expand Down
Loading

0 comments on commit b84af3f

Please sign in to comment.