diff options
| author | Stefan Boberg <[email protected]> | 2026-03-23 12:23:19 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-03-23 12:23:19 +0100 |
| commit | 26aa50677403e4c5ad053b221bc7264fe1d249f2 (patch) | |
| tree | de196528390e8875b0551d52071038120d969f73 /docs/dev/CODING.md | |
| parent | Process management improvements (#881) (diff) | |
| download | zen-26aa50677403e4c5ad053b221bc7264fe1d249f2.tar.xz zen-26aa50677403e4c5ad053b221bc7264fe1d249f2.zip | |
Documentation updates (#882)
Restructured the docs folder in preparation for more docs. Improved the contents a bit.
Diffstat (limited to 'docs/dev/CODING.md')
| -rw-r--r-- | docs/dev/CODING.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/dev/CODING.md b/docs/dev/CODING.md new file mode 100644 index 000000000..8924c8107 --- /dev/null +++ b/docs/dev/CODING.md @@ -0,0 +1,30 @@ +# Naming Conventions + +The naming conventions for Zen are intended to remain close to the Unreal Engine coding style, with some minor exceptions wrt prefixes. + +* Classes/Structs - `PascalCase` +* Functions - `PascalCase()` +* Class member variables - `m_PascalCase` +* Global variables - `g_PascalCase` +* Static variables - `s_PascalCase` +* Thread local variables - `t_PascalCase` + +Those who are familiar with the UE coding standards will note that we do not require or encourage `F` prefixes on struct or classes, and we expect class members to have a `m_` member prefix. + +# Code formatting + +To ensure consistent formatting we rely on `clang-format` to automatically format source code. This leads to consistent formatting which should lead to fewer surprises and more straightforward merging. + +Formatting is ensured by using [pre-commit](https://pre-commit.com/) + +- [Ensure you have a Python install](https://www.python.org/downloads/) and that Python has been added to the PATH environment variable +- [Install pre-commit](https://pre-commit.com/#installation) so it is available in PATH +- Run pre-commit manually on staged files `pre-commit run` +- Run pre-commit manually on all files `pre-commit run --all-files`. There is also a `xmake precommit` shortcut which may be easier to remember +- Install git commit hooks `pre-commit install`, which will automatically run before every commit. + +# Standard Library / Containers + +Unlike UE5, use of `std` containers etc is acceptable though in some cases you may also consider using `eastl` equivalents which can +sometimes enable more efficient runtime. In particular, `eastl::fixed_vector` et al can eliminate memory allocations by pre-allocating +backing memory for common (small) sizes internally while still allowing larger sizes by overflowing to the heap. |