Skip to content

Instantly share code, notes, and snippets.

@johnbartholomew
Last active December 16, 2015 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnbartholomew/5434034 to your computer and use it in GitHub Desktop.
Save johnbartholomew/5434034 to your computer and use it in GitHub Desktop.
Pioneer approximate code style conventions
Classes, namespaces and methods are LikeThis.
Non-public member variables are m_likeThis.
Local variables and local constants are likeThis.
Public member variables are likeThis, but you should think about making them non-public and providing an accessor instead.
Accessors are called GetFooBar() and SetFooBar(), but you should think about whether you really want to provide SetFooBar() or if you want to provide nicer verb methods (e.g., Missile provides Arm() and Disarm(), rather than SetArmed()).
Static globals (ie, file-scoped globals) are s_fooBar.
Global/class-member/static global constants (including enum values) are LIKE_THIS.
Parentheses and braces for statements (if/while/for/etc) are like this:
for (int i = 0; i < 5; ++i) {
// code
}
Braces for function definitions start on the next line.
Braces for class definitions are on the same line as the class keyword, ie:
class Foo : public Bar {
};
Class visibility specifiers (public:,protected:,private: etc) are not indented. They are like this:
class Foo : public Bar {
public:
Foo();
~Foo();
};
Indent with tabs, one tab per level.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment