Skip to content

Latest commit

 

History

History
53 lines (30 loc) · 1.45 KB

c_and_cpp.md

File metadata and controls

53 lines (30 loc) · 1.45 KB

C/C++

Don't use C (use Rust)

C-libraries are simple to bind to Rust. There are plenty of examples of how to do this in a good way.

For C++ libraries that do not have a C API as well things get complicated and you might have to use native C++.

One command builds

Make sure there's a target in your Dockerfile that provides an installable package, especially if the program for some reason cannot be run under Docker (if it has some weird license management thing like Sightcorp)

Enable all warnings

Enable all compiler warnings: -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic

Clean up you code so that you don't get a ton of warnings when compiling.

Use pre-commit template

Good template To Be Made, but autoformatter (clang-format) and linter with the minimal config in this repo at least.

Coding style

Google coding style

Use clang-format with BasedOnStyle: Google in .clang-format file.

Unit testing framework

Google Test

Use Bazel (or CMake) for building

Google Test recommends Bazel but also supports CMake.

Linter

Use cpplint (it's designed by Google for Google style).