Skip to content
This repository has been archived by the owner on Oct 11, 2020. It is now read-only.

Latest commit

 

History

History
72 lines (59 loc) · 2.85 KB

CODEDESIGN.md

File metadata and controls

72 lines (59 loc) · 2.85 KB

Code Design

C++ Version

  • Currently, code should target C++17 standard, i.e., should not use C++2x features yet. The C++ version targeted by this guide will advance (aggressively) over time
  • Do not use non-standard extensions
  • Consider portability to other environments before using features from C++14 and C++17 in your project

Header Files

  • In general, every .cpp file should have an associated .hpp file
  • Correct use of header files can make a huge difference to the readability, size and performance of your code
  • We use #pragma include guards
#pragma once
  • Include headers in the following order: Related header, C system headers, C++ standard library headers, other libraries' headers, your project's headers
  • All of a project's header files should be listed as descendants of the project's source directory without use of UNIX directory aliases . (the current directory) or .. (the parent directory)

Namespaces

  • Like every other module of Inexor the entity system uses namespaces:
namespace inexor {
namespace entity_system {
   // Code here..
};
};
  • Namespaces wrap the entire source file after includes and forward declarations of classes from other namespaces.

Standard Libraries

The following standard libraries will be used in the code:

Code Formating

Naming convention

Entity Kind Naming Convention
Namespace snake_case
Class PascalCase
Enum SCREAMING_SNAKE_CASE
Enumerator PascalCase
Typedef PascalCase
Union PascalCase
Member Function snake_case
Member Field snake_case
Global Function snake_case
Global Variable snake_case
Method Parameter snake_case
Local Variable snake_case
Macro SCREAMING_SNAKE_CASE
Directory Names kebab-case
Test Files Postfix _tests
Benchmark Files Postfix _benchmark

Multithreading

TODO