From c198cc923ef5a8b8dcc0a24ca1f2f77c631205d6 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 4 Sep 2019 15:10:49 -0700 Subject: Update CODING guidelines - Reference clang-format - Fix typos --- CODING.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CODING.md b/CODING.md index 9c7e1548d..ebba79310 100644 --- a/CODING.md +++ b/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 bar = ## CMake-specific Guidelines -* CMake commands written in lowercase. +* CMake commands are written in lowercase. ## Revision Control Hygiene -- cgit v1.2.3