This repository has been archived by the owner on Sep 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Cpp coding convention
Grzegorz Mrukwa edited this page Jul 27, 2017
·
5 revisions
Descriptive names. If necessary, prefer long names over shortcuts.
- Class names: PascalCase
- Methods/Function names: PascalCase
- Local variables: camelCase
- Class fields: m_Name
- Static names: s_Name
- Global variables: g_Name
- Namespaces: PascalCase
- Constants: UPPERCASE_WITH_UNDERSCORES
- Macros: SAME_AS_ABOVE
- Enum names: PascalCase
- Constants in enums: UPPERCASE_WITH_UNDERSCORES
Braces:
if (true)
{
// not java-like
}
Also, prefixing pointers with p, i. e. m_pWindow, or pObject.
We use short alias of each basic type, i.e. we use unsigned
instead of
unsigned int
.
Please avoid using auto as it can potentially make the code barely readable.
When in doubt, please refer to http://www.insomniacgames.com/core-coding-standard/
When creating new project in C++, one should remember to add appropriate property sheet just after creation of the project. These file is dependent on the type of project created:
- For native C++ code project, the file is:
NativeProject.props
- For native C++ test project, the file is:
NativeTestProject.props
- For managed C++/CLI code project, the file is:
ManagedCppProject.props
- For managed C++/CLI test project, the file is:
ManagedCppTestProject.props
All property sheet files are located in .../src/PropertySheets
.