Coding Conventions

From PioneerWiki
Revision as of 21:52, 16 September 2012 by Luomu (talk | contribs) (Imported from GH wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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;