- Refer to the clang-format configuration file for the base standard.
- Prioritize readability over adherence to the clang-format configuration when conflicts arise.
- Write all names in snake_case (lowercase letters with underscores separating words).
- Start all argument names with
a_.
- Start all pointer names with
p_.
- Start all global variables/constants with
g_.
- Start all variables/constants that are global within a file with
f_.
- Start all class, struct, or union names with a capital letter if there is a possibility to create an object of this type.
- Start all other case names with a lowercase letter.
- Use only one section per access specifier (
public,protected,private). - Order access specifiers as follows:
publicfirst,protectedsecond,privatelast.
- Follow the Rule of 5 or the Rule of 0 for special member functions.
- Do not use
m_prefix for members. Usethis->to reference members.
- Maintain the same order in the initialization list as in the declaration in the class.
- Do not use members to create another in the initialization list.
- Prefer standard libraries over custom implementations for common functionalities to ensure code reliability and maintainability.
- Include necessary headers for the standard libraries you are using.
- Avoid using deprecated standard library features.
- Do not use
using namespace std;. - Use
stdtypes fromcstdint.
- Do not use
goto. - Use
autoonly if it is necessary. using namespacein.hppfiles is not allowed.- Add a comment to the end of a namespace (
// namespace name). - Function arguments can be pointers if they are modified, and const references if they are not modified.
- Use Yoda notation for comparisons (e.g.,
if (5 == x)). - Use
constalways if you can. - Group includes. Includes should be sorted inside each group.
- Write one-line
ifstatements with brackets.