-
Notifications
You must be signed in to change notification settings - Fork 42
Code Style Guide
Vlad edited this page Nov 9, 2016
·
12 revisions
Please follow those rules when writing code for Sfall.
- Use tabs for indentation. Recommended tab length in your editor is 4 characters.
- Place opening brackets always on the same line, except for namespace brackets.
- Avoid writing control blocks without brackets.
- Always put spaces after control flow operators like if, for, while, etc.
- Put spaces around binary operators like *, +, etc.
- Put space after comma (,) in argument lists, etc.
- Put 1 empty line between each function, class or class member declaration.
- Try to avoid writing complex ASM code (code with any condition, loop, etc.). If you want to use Engine functions, add/use Wrappers and then write all your logic in human-friendly C++ language.
- Don't mix up code with and without semicolons at the end of lines. Be consistent.
- Never use numeric literals for known addresses! Add/use constants.
- Avoid writing code in C-style, like using sizeof/memset/etc when working with arrays (use std containers).
- Use nullptr instead of NULL constant.
- Try using std::string for strings when you need to copy, store, modify strings, etc.