Slightly modified "Chromium" clang-tidy
configuration.
See https://google.github.io/styleguide/cppguide.html.
Quick start:
Class member variables
class Thing {
std::string foo_;
std::string bar_baz_;
};
Struct member variables
struct Thing {
std::string foo;
std::string bar_baz;
};
Class names
class Foo;
class BarBaz;
Functions
DoTheFoo();
Bar();
Methods
struct Thing {
uint64_t Size(); // Getter
void DoTheFoo();
};
Constants
const int kFooBarBaz = 1;
Enums
enum class Foo {
kUnknown = 0,
kBar,
};
Divergence: file names
In C:
file_name.c
file_name.h
In C++:
file_name.cpp
file_name.hpp
Divergence: getters
struct Thing {
// Good
uint64_t Size();
//Bad
uint64_t size();
};
C++17.
C99.
Use googletest
.
Symbols should be hidden by default. Only export what is part of the public API.
Use #pragma once
.