I suppose that coding conventions shall be updated after C++11 introduction. I’m going to write my proposal and rationale. Please, comment.
- The macro
NULLor integer constant 0 should not be used for null pointers,nullptris used instead. Replace 0-s in old code. (VA)- Why: Best way to declare null pointer.
- The keyword
overrideshall be used wherever possible (?? except destructors ??). Update old codebase. (VA)- Why: Prevent errors.
- The keyword
finalshall not be used except rare specific cases (e.g. virtual interface wrapping)- Why: It makes code reuse hard. Think twice before sealing the interface.
- The
usingshall be used instead oftypedef. Replace typedefs in old code. (VA)- Why: More readable.
- The
{}constructor shall never be used.-
Why: Keep code consistent. It gives too few benefit to update the whole codebase.
- IMO, the = initialization is the most readable.
-
Why: Keep code consistent. It gives too few benefit to update the whole codebase.
- The range-based
forloop shall be used wherever possible. Update old codebase when possible. (VA)- Why: More readable.
-
autoshall not be used for one-word types and simple templates.- Why: Keep code readablilty when type name is short enough. Keep code consistent.
-
autoshall be used for unknown types in templates (avoidtypenameanddecltype) and long nested types (akaHashMap<String, int>::KeyValue). ?? Shall other cases be here ?? (VA)- Why: Improve code readability when type name gives no information. Check the link for example: https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html
- Inplace member initialization shall be used wherever possible. Update old codebase.
- Why: Easier to read, harder to mistake.
I’ve marked with (VA) tag items that could be done automatically via Visual Assist.





