1.6 KiB
trigger
| trigger |
|---|
| always_on |
Code compiles with all warning active and warning as errors. use static_cast or reinterpret_cast but not parenthesis for casting. No exceptions Use nodiscard when risk of memory leak (anything returning pointer) auto is allowed but when its a pointer add the * and when reference adds the & Add Assert to make sure all assumptions are good. Parameters of functions for example should be verified with Assert. Code should be self commented using proper variable names, types and functions. No need to add comments most of the time, unless the algorithm is very complex and hard to read. When creating a new system framework, make a unit test. To make the unit test we should not modify the framework code for special unit test case. Always put braces for if,else,for,while etc. Coding Style: Note: The code base do not fully use those, if in doubt, use this style and not legacy style. Types (Structs/Enums/Unions) : PascalCase. Exemple : Arena, String8, DbgTarget, EvalValue Primitive Types : lower_snake_case. Exemple: uint8, uint16, uint32, uint64, size_t, index_t, int32... Function Names: lower_snake_case. Exemple: str16_from_8. Namespace: do not use c++ namespace, add PascalCase prefix to function names. Exemple: W32_do_something Local Variables and parameters: lower_snake_case. Exemple: arena, str, data. Struct members: lower_snake_case. Exemple: data, node, next. global/static variables: lower_snake_case prefixed. Exemple: g_my_global. const variables: lower_snake_case prefixed. Exemple: k_my_const_var. Defines and Macros: ALL_CAPS_SNAKE. Exemple: MY_MACRO