Fetching contributors…
Cannot retrieve contributors at this time
113 lines (79 sloc) 2.67 KB
Coding Guidelines (C++)

Disclaimer: Not all ACRE2's code complies with the below coding guidelines, we are working towards improving as much as we can!

Majority of the SQF Code Style Guidelines also apply to C++ code! Differences and C++-specific styles are noted on this page.

Code Indentation

All indents should be four normal spaces.

Variable Names

All variable names should follow snake_formatting, with all letters in lowercase. Variable names should not start with a number.


uint32_t my_number = 1;
std::string test_string = "abc";


Arguments to any function, method, constructor, etc should be suffixed with a single _.


void some_function(uint32_t arg_);

class test_class {
    test_class(std::string string_);

Control Braces

Opening braces should always be on the same line as their block identifier (such as if, else, for, etc). All closing braces should be on their own line.


if (test) {
    // do something
else {
    // something else

for (auto it : some_list_) {
    // blah blah

void some_function() {
    // implementation


All namespaces should be descendants of intercept::. Namespaces that are meant to hold internal or implementation specific code not exposed readily to end users should be prefixed with two (2) underscores __.

namespace acre {
    namespace __my_helpers {
        // internal helper functions
    namespace my_functionality {
        // exposed namespace that might implement above helpers


All classes should strictly maintain separation between declarations and definitions. There should always be a corresponding .cpp file for every .hpp file that defines a class. Furthermore it is recommended, but not required that all classes be implemented in their own declaration and definition files. Developers should make judgement calls on when they feel a class should be split out into its own files.

Protected/Private Members/Methods

All protected/private members and methods should be prefixed with a single _ to provide easy identification that the value is not in the public scope.


class test_class {
    test_class(uint32_t init_);
    uint32_t _val;

test_class::test_class(uint32_t init_) : _val(init_) {};


All templates should use capital letters or words that start with capital letters that describe what they are are templating.


template<typename T, size_t Size>
class stack_array {
    T array_holder[Size];