-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Daniel Zahka edited this page Sep 1, 2022
·
1 revision
Rules:
-
autoalways - East
conste.g. (auto const val = ...,auto const& ref = ...) - For naming, I use: the google c++ style. Ignore the file naming rules, I use
.cpp/.hppextensions. - Separate private interfaces from public interfaces.
- Put library public interface header files
.hppin a<library_src_dir>/includesubdirectory.#includethese headers with angle brackets#include <> - Put library private interface headers next to the
.cppfiles, and include them with quotes#include ""
- Put library public interface header files
- Don't create a new feature without tests
- You can only test the public interface of a library. If you find yourself wanting to test something that is not part of the public interface, you probably need to split the component into another library that has the feature in its public interface.
- Don't use output parameters in functions. If you want to return multiple things from a function, use c++ destructuring e.g.
auto [val1, val2] = MultiReturnFunc(); - Put whatever possible in
.cppfiles. Only put things in.hppfiles if the client needs the implementation along with interface e.g. templates, constexpr functions - Don't copy and paste. Refactor if you have to.
- Don't
#include <iostream>or usestd::coutfor logging. Usespdlogfor logging andfmtfor formatting strings. - If you want to make a note to implement or fix something create a github issue, don't leave inline comments
//TODO:. If you find TODO comments that I put in there you can make an issue and delete them if you want.
Control the visibility of dependencies using PRIVATE, INTERFACE, and PUBLIC specifiers.
Set up your editor to use clang-format.
- Don't commit broken code
- Don't commit code that doesn't pass tests
- try to break up commits into single features