Don’t sweat the small stuff, such as how much to indent? space or
tabs? or must have comment etc.
Use descriptive function and variable name to state what youmean.Even it’s a little longer. Most code is read a lot more than
it is typed.
Don’t use abbreviation name unless it’s very common.
Don’t need to use type indicator for all variable. Hungarian notation
offer no benefit for object-oriented language, and impossible use in
template. But for some generic concept, such as reference, pointer
and STL container, you can use it such as: "ptr_map_dic". Modern
IDE(such as Visual Studio and Understand) support pop up message
when you hover your mouse over a variable.
For global scope, use g_ prefix; m_ prefix for member variable;
For constant name, use k_ prefix and upperCamelCase;
Using uppercase and underscores for preprocessor Macro;
Using upperCamelCase for Classes, Structures, Enumerations, Typedef
and Constants;
Using lowerCamelCase and verb for function. Such as "getSth" and
"doSth"
Using lowercase and underscore and noun for variable and parameter
name. Because for long variable name, It’s easier to read. Such as
"sth_for_dinner"
Using "other" or "rhs" as name for copy ctor and assignment operator.
Pointer and reference symbol is near to data type.
The prefix "is" should be used for boolean variables and methods which
return bool.