Code style
Last updated: 2021-08-16
A consistent code style is important for everyone. Pull requests are only accepted if they follow our code style. But don't worry, it's not that difficult. The main points are:
- Reformat your code with
clang-format
. There is a.clang-format
file in the repository root. - Function and method names are in
camelCase
- Class and struct names are in
PascalCase
- Namespaces, files and directories are named in
snake_case
- Headers have the extension
.h
and C++ source files are named.cpp
- Macros and constants are in
SCREAMING_SNAKE_CASE
and macros are prefixed withBRICKSIM_
- Typedefs are
snake_case_t
(with_t
postfix) - No
using namespace
in headers and nousing namespace std
in.cpp
files - When there is no explicit rule for something, ask or adapt to the existing code