progmasoft-cpp
The C++ style guide of Progmasoft: naming, formatting, language rules, errors, ownership, ABI, testing and tooling.
Clonegit clone https://git.progmasoft.com/progmasoft-cpp
Take the examples from Catch3; drop the lowercase-namespace exception
- Commit
1fce0749209e08033a5e7a35037a9ae00d2c9546- Author
- Leitwolf11 ·
- Parents
84cf683ca325
Changes
ADOPTING.md | 3 --- CHANGELOG.md | 4 ++++ Progmasoft_Core_Cpp_Coding_Guidelines/Common/NAMING.md | 10 +++------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/ADOPTING.md b/ADOPTING.md index 5c1112e..e6673dc 100644 --- a/ADOPTING.md +++ b/ADOPTING.md @@ -46,8 +46,6 @@ use exceptions because its host does. List them in the contributing guide, each ```markdown ### Deviations -- The intermediate representations use the lowercase namespaces `tala::core`, `tala::xpp` and `tala::xmm`, because - they are qualified on almost every line of the compiler (Naming, 3.4). - Assertion failures are reported by throwing, as the Catch2 API requires; exceptions stay inside the library (Errors, 7.1). ``` @@ -65,5 +63,4 @@ mixed with a change in behavior, so that review and `git blame` stay useful. | Project | Deviations recorded in | | --- | --- | -| [Progmasoft/tala](https://github.com/Progmasoft/tala) | `Documents/Contributing/STYLE-AND-LICENSING.md` | | [Progmasoft/catch3](https://github.com/Progmasoft/catch3) | the Progmasoft-authored sources under `src/Progmasoft/`; code derived from Catch2 keeps its upstream style | diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b896d3..1e54a4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ A revision of Progmasoft C/C++ Styles is named by its date. A change that requir ## Unreleased +Naming 3.4 no longer allows a short lowercase namespace for a heavily used data model: every namespace is +`PascalCase` under the project's root. A project that keeps such a namespace records it as a deviation (Adopting, 3). +The examples name Catch3's namespaces. + The repository is named Progmasoft C/C++ Styles, and its C++ guide Progmasoft Core C++ Coding Guidelines; both were Progmasoft C++ Style. diff --git a/Progmasoft_Core_Cpp_Coding_Guidelines/Common/NAMING.md b/Progmasoft_Core_Cpp_Coding_Guidelines/Common/NAMING.md index d575ec8..db4b032 100644 --- a/Progmasoft_Core_Cpp_Coding_Guidelines/Common/NAMING.md +++ b/Progmasoft_Core_Cpp_Coding_Guidelines/Common/NAMING.md @@ -10,7 +10,7 @@ of thing a name is before they look it up; the words tell them what it is for. | Kind | Style | Example | | --- | --- | --- | -| Namespace | `PascalCase` | `Progmasoft::Tala::Analysis` | +| Namespace | `PascalCase` | `Progmasoft::Catch3::Runner` | | Class, struct, union, enum, concept, type alias | `PascalCase` | `ControlFlowGraph`, `using BlockId = std::uint32_t;` | | Template type parameter | `PascalCase` | `template<typename Value>` | | Function, member function, static member function | `PascalCase` | `AnalyzeLiveness`, `graph.BlockCount()`, `Rectangle::Create` | @@ -62,18 +62,14 @@ pointee is the subject. ## 3.4 Namespaces A project's code lives under one root namespace named for the organization or the project, then one level per product -and component: `Progmasoft::Tala::Backend::LLVM`. Use C++17 nested namespace definitions: -`namespace Progmasoft::Tala::Analysis`. +and component: `Progmasoft::Catch3::Runner`. Use C++17 nested namespace definitions: +`namespace Progmasoft::Catch3::Runner`. Each component owns one namespace and every name in it. Two components do not add declarations to the same namespace. An implementation detail that must be visible in a header, such as a helper of a template, lives in a nested `Detail` namespace, which callers must not use. -A project may keep a short lowercase namespace for a stable data model that is used heavily and qualified often, such -as an intermediate representation (`tala::core`, `tala::xpp`). This is a deliberate, documented exception, not a second -convention. - ## 3.5 Files A file is named after the main thing it declares, in the casing of that thing: `ControlFlowGraph.hpp` and