Filename
InstInterfaceDef.h
#ifndef Fuanda_workplan_inst_interface_def_h_
#define Fuanda_workplan_inst_interface_def_h_
#pragma pack (push,1)/* Specify 1-byte alignment */
#pragma pack (POP)/* Restore default byte alignment */
#endif
class / structure
Naming of C + + classes/structs |
The name of the class begins with the capital letter "C" followed by one or more words. For ease of definition, capitalize the first letter of each word. |
Recommended form of composition |
The naming of classes is recommended in the form of "noun" or "adjective + noun", for example: "Canalyzer", "Cfastvector" .... |
Naming of traditional C structures |
The names of the traditional C structures are all composed of uppercase letters, with underscores defined between the words, for example: "Service_status", "Driver_info" |
typedef struct RESPONSEHEAD
{
}response_head;
Function
Name of the function |
The name of a function is made up of one or more words. For ease of definition, capitalize the first letter of each word. |
Recommended form of composition |
Function names should be in the form of "verbs" or "verbs + nouns" (verb phrases). For example: "GetName ()", "SetValue ()", "Erase ()", "reserve ()" .... |
Protect member functions |
The beginning of the protection member function should be preceded by an underscore "_" to differentiate, for example: "_setstate ()" .... |
Private member functions |
Similarly, the start of a private member function should be preceded by a two underscore "__", for example: "__destroyimp ()" .... |
Virtual functions |
Virtual functions are used to start with "do", such as: "Dorefresh ()", "_doencryption ()" .... |
Back Harmonic event handler function |
The back harmonic event handler is used to start with the word "on". For example: "_ontimer ()", "OnExit ()" .... |
|
Variable
Name of the variable |
The variable name consists of a scope prefix + type prefix + one or more words. For ease of definition, capitalize the first letter of each word. For some simple and straightforward local variables, you can also use simplified methods such as: I, J, K, X, Y, z .... |
Scope prefix |
The scope prefix indicates the visible range of a variable. There are several scopes that can be used:
Prefix |
Description |
No |
Local variables |
M_ |
Member variable for Class (member) |
Sm_ |
Static member variable of class (static member) |
S_ |
Static variable (statics) |
G_ |
External global Variables (GLOBALS) |
Sg_ |
Static global variables (statically global) |
Gg_ |
Shared data segment global variables shared between processes (World global) |
You should use as few global variables as possible unless you have to. |
Type prefix |
The type prefix indicates the type of a variable, which can be as follows:
Prefix |
Description |
N |
Integer and bit-field variables (number) |
E |
enum-type variable (enumeration) |
C |
Character variable (char) |
B |
Boolean variable (BOOL) |
F |
Floating-point variable (float) |
P |
Pointer-type variables and iterations (pointer) |
Pfn |
Pointer variables and function object pointers, especially for pointers to functions (pointer of function) |
A |
Arrays (Array) |
I |
Example of a class (instance) For frequently used classes, you can also define specific prefixes, such as: std::string and std::wstring class prefixes can be defined as "St", the Std::vector class prefix can be defined as "V" and so on. |
Type prefixes can be combined, such as "AC" for an array of characters, "PPN" for pointers to pointers to integral types, and so on. |
Recommended form of composition |
The name of the variable should use "noun" or "adjective + noun". For example: "NCode", "M_nstate", "nmaxwidth" .... |
|
Constant
Support for constants has been introduced in C + +, with the following naming conventions for constants:
Name of the constant |
Constant names consist of type prefixes + all uppercase letters, which are defined by underscores, such as: Cdelimiter, Nmax_buffer .... The definition of a type prefix is the same as in a variable naming convention. |
|
enumerations, unions, typedef
enumerations, unions, and typedef statements are simple means of defining new types, and their naming conventions are:
Enumeration, union, typedef naming |
The type names generated by enumerations, unions, and typedef statements are made up of all uppercase letters, and the words are defined by underscores, such as: Far_proc, Error_type .... |
|
Macros, enumeration values
Names of macros, enumeration values |
Macros and enumeration values are made up of all uppercase letters, which are defined by underscores, such as: Error_unknown, op_stop .... |
|
C + + Naming conventions