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
- Ensure you have a Python install and that Python has been added to the PATH environment variable
- Install pre-commit 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 axmake precommitshortcut 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.