mirror of
https://github.com/saymrwulf/uhd.git
synced 2026-05-14 20:58:09 +00:00
Update CODING guidelines
- Reference clang-format - Fix typos
This commit is contained in:
parent
37c2463798
commit
c198cc923e
1 changed files with 7 additions and 4 deletions
11
CODING.md
11
CODING.md
|
|
@ -29,19 +29,21 @@ helpful move for the team and future maintainability of the UHD codebase.
|
|||
terminal, and do side-by-side views of code on small-ish screens, so this is
|
||||
actually pretty helpful.
|
||||
* Go crazy with log messages. Trace-level log messages in particular can be
|
||||
used copiously and freely (unless in rare cases where the can interfere with
|
||||
used copiously and freely (unless in rare cases where they can interfere with
|
||||
performance). Note that in C++, we have the option of fully compiling out
|
||||
trace-level messages (and even higher levels).
|
||||
|
||||
## C++-specific Guidelines
|
||||
|
||||
* All C++ code must be formatted according to the .clang-format file in the root
|
||||
of the project.
|
||||
* If in doubt, consult the [C++ Core Guidelines][CppCoreGuidelines]. If the
|
||||
guidelines have an answer, and it works for you, just pick that.
|
||||
* Use Doxygen doc-blocks copiously.
|
||||
* All things equal, prefer standard C++ constructs over Boost constructs (see
|
||||
also Boost guidelines).
|
||||
* Given the option, prefer C++ lambdas over std::bind, and just don't use
|
||||
boost::bind if you can.
|
||||
boost::bind.
|
||||
* `size_t` is the correct container for all indexing of C++ structures (such
|
||||
as vectors). But keep in mind that the size of `size_t` is
|
||||
*platform-dependent*!
|
||||
|
|
@ -52,7 +54,8 @@ helpful move for the team and future maintainability of the UHD codebase.
|
|||
The rationale is to include from most to least specific. This is the best way
|
||||
to catch missing includes (if you were to include the standard header first,
|
||||
it would be available to all include files that come later. If they need that
|
||||
standard header too, they should be including it themselves).
|
||||
standard header too, they should be including it themselves). Note that
|
||||
clang-format will do this for you.
|
||||
Example:
|
||||
|
||||
```cpp
|
||||
|
|
@ -127,7 +130,7 @@ std::map<std::string, std::string> bar =
|
|||
|
||||
## CMake-specific Guidelines
|
||||
|
||||
* CMake commands written in lowercase.
|
||||
* CMake commands are written in lowercase.
|
||||
|
||||
## Revision Control Hygiene
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue