coding-standards

C++

C++ and C code should conform to ISO C++ with the Google style conventions in terms of variable and class names, and layout.

Style conflicts We choose to follow the ISO guidelines where a Google-specific decision conflicts with the ISO. The main example of this is the [recommendation to throw exceptions](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Re-throw), which is discouraged by Google. As this is recommended by ISO and not related to naming we shall throw exceptions.

We will use modern C++ features - including range-based for loops and lambda expressions - where this improves readability. This means we prefer to work with C++11, C++17, or newer.

We use the clang-tidy linter configured to obey Google style. That is:

clang-tidy  --format-style='google'

We also recommend using cppcheck, a static analyser. It can be helpful to improve code quality in general.

Our preferred build system for C++ code projects is CMake.

Further reading