Naming Conventions

Files
header files: somefile.hpp

source files: somefile.cpp

No CamelCase and no underscores, please.

Namesspaces
Example: ThisIsANamespace

Namespaces in apps/openmw will have a MW-prefix (MWThisIsANamespace). Obviously you should try to keep these names short, but don't use hard to read abbreviations.

Classes
Example: ThisIsAClass

Functions
Example: thisIsAFunction

Local Variables &amp; Parameters
Example: thisIsAVariable

Member Variables
Non-static: mThisIsAVariable

Static: sThisIsAVariable

Note that formally the name of the variable would still be thisIsAVariable. The m and the s are scope sigils. Some other languages (e.g. Ruby) provide these as part of the syntax. C doesn't, so we have to encode them in the name. And no, this is not Hungarian notation.

Global Variables
Shame on you!

Enums
Example:


 * TypePrefix_SomeName
 * TypePrefix_SomeOtherName
 * TpyePrefix_AndSomeMore

The TypePrefix should be chosen appropriately for the purpose of the enum. Don't use all uppercase names. These would make the enums look like preprocessor constants.

Preprocessor constants
Example: THISISACONSTANT

Since preprocessor constants are the only part of the language that does not respect namespaces, these must be clearly distinguished from everything else.

Don't use these for anything but include guards and conditional compiling.

Acronyms
Acronyms in names should follow the guidelines on this page too, even if that is not how you would normally write them, e.g.: a class representing a NPC would be called Npc. Otherwise it would look like a preprocessor macro.