L "Rule 3-1-8" uses the correct set of antonyms to name a variable with a mutually exclusive meaning or a function of the opposite action.
For example:
int minvalue;
int maxValue;
int SetValue (...);
int GetValue (...);
2 "recommendation 3-1-1" to avoid the number of names, such as Value1,value2, unless the logic does need to number. This is to prevent programmers from being lazy and refusing to name their brains to cause meaningless names (because it's the easiest to use numbers).
3.2 Simple Windows Application naming rules
The author makes a reasonable simplification of the "Hungarian" naming rules, the following naming rules are easy to use and more suitable for the development of Windows application software.
L The "rule 3-2-1" class name and function name are grouped by words that begin with uppercase letters.
For example:
Class Node; Class name
Class Leafnode; Class name
void Draw (void); The name of the function
void SetValue (int value); The name of the function
L "rule 3-2-2" variables and arguments are grouped by words that begin with a lowercase letter.
For example:
BOOL Flag;
int DrawMode;
L "rule 3-2-3" constants are all in uppercase letters, with underscores separating the words.
For example:
const int MAX = 100;
const int max_length = 100;
L "rule 3-2-4" static variable prefix s_ (for static).
For example:
void Init (...)
{
static int s_initvalue; static variables
...
}
L "Rule 3-2-5" if a global variable is required, prefix the global variable with g_ (representing global).
For example:
int g_howmanypeople; Global variables
int G_howmuchmoney; Global variables
The data members of the "rule 3-2-6" class are prefixed with m_ (representing member), which prevents the data members from having the same name as the parameters of the members function.
For example:
void Object::setvalue (int width, int height)
{
M_width = width;
M_height = height;
}
L "rule 3-2-7" to prevent conflicts in some identifiers and other software libraries in a software library, you can add prefixes that reflect the nature of the software for various identifiers. For example, all library functions for the three-dimensional graphics standard OpenGL begin with GL, and all constants (or macro definitions) begin with GL.
3.3 Simple UNIX Application naming rules
< note: The original text here is missing >