Coding Conventions

From PioneerWiki
Jump to: navigation, search

Classes

Class names in camel case starting with upper case like so:

class MyClass {};

Class member variables prefixed with m_, camel case starting with lower case:

class MyClass {
public:
    int m_someValue;
    std::string m_anotherValue;
};

Note that to avoid verbosity the above is not followed for classes that are used more like structs, like vector3.

Class functions should be camel case starting with upper case:

class MyClass {
public:
    void MyFunction() {}
};

Global variables

Global variables must be prefixed with g_, and use camel case starting with lower case:

int g_screenWidth;

Variables with static scope should be prefixed with s_:

static int s_someGlobalForJustThisFile;