Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

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, 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.

Versioning

Define the version in CMake:

project(MyProject VERSION 1.2.0)

Releasing

For more general information on releasing, see the release management guide.

For C++ libraries, distribution depends on your target audience:

  • Source distribution: Tag releases on GitHub, users build from source
  • Package managers: Submit to vcpkg, Conan, or conda-forge
  • System packages: Create .deb, .rpm, or other system-specific packages
  • Header-only libraries: Can be distributed as simple Git repositories

Further reading