2.4 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
Modular Architecture & Include Rules:
- Juliet uses a single-pass unity build pattern.
- Layer aggregators
<layer>_inc.hand<layer>_inc.cdictate header and source inclusion order. - Top-level translation units (e.g.
appbin_main.c) include the layer_incfiles in dependency order (core->render->ui...). - Sub-files within a module (e.g.
core.h,core_arena.c,render.c) must NEVER directly#includeother module headers, sibling headers, or configuration defines (core_defines.h). - Never add
#includedirectives to sub-files to satisfy standalone LSP/compiler diagnostics. Tooling (new_project_gen.c/compile_commands.json) must supply preceding includes dynamically based on the base file include order. - Always explain root causes and confirm with the user before editing project architecture or files.