blob: 8924c8107a7682dc32b2646631f7c6f194a211de (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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.
|