Skip to content

Commit 5a15544

Browse files
author
nitrocaster
committed
Update coding conventions.
1 parent ddfa7fc commit 5a15544

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

doc/procedure/cpp_code.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,10 @@ In string initialization and null termination, you must use 0:
469469
Naming conventions:
470470
- Do choose easily readable identifier names. For example, a variable named
471471
horizontalAlignment is more readable in English than alignmentHorizontal.
472-
- Do not use Hungarian notation except in two cases:
472+
- Do not use Hungarian notation except in the following cases:
473473
- UI-related code, i.e. btnOpen, lblMessage, chkRecursive, cbGameType
474474
- Interface classes: IClient, IGameLevel, IGamePersistent, etc
475+
- Template type arguments: TBase, TResult
475476

476477
Casing styles:
477478
- class/struct/enum: PascalCase
@@ -995,6 +996,19 @@ Use #include <Foo.hpp> for external system files.
995996
#include "IO/IReader.hpp" // from src/xrCore/IO/IReader.hpp
996997
#include <algorithm>
997998

999+
Free function used in one CPP file:
1000+
should be implemented static, and a declaration in the CPP file should only
1001+
be added if used before implementation.
1002+
Free function used out of the CPP file (global):
1003+
should be declared in the HPP file.
1004+
class/struct used in one CPP file:
1005+
should be declared inside the CPP file.
1006+
A pointer is needed out of the CPP file:
1007+
a forward declaration should be in the HPP file, and the definition should
1008+
be in the C file.
1009+
class/struct members are needed out of the CPP file:
1010+
declare it in the HPP file.
1011+
9981012
Comments of XXX should be <keywords>: <comment>. Multiple names should be
9991013
separated with a '/':
10001014
BAD

0 commit comments

Comments
 (0)