Name of function:
• Refer to the naming conventions for Windows APIs.
• It is recommended to use the movable-object structure. Function names should clearly reflect the function and purpose of the functions.
• The function name must be no longer than 30 characters.
• The first letter of the function name must be capitalized.
• The global function must begin with a lowercase prefix "g".
4. Variable name:
In principle, the names of variables are named in accordance with the Hungarian notation. That is: prefix + type + variable name
1) Format:
[M_|s_|g_] Type [class name|struct name] variable name
2) Explanation:
m_: Member variables of a class
ms_: Static member Variable of class
s_: Static global variables
g_: Normal global variables
• Type abbreviations (types)
Char, Tchar:ch
char[],tchar[]: SZ
bool, BOOL:B
int, __int16,__int32,__int64:n
long:l
double:d
float:ft
· Byte:by
· Word:w
· Dword:dw
Unsigned:u
FUNCTION:FN
P:pointer
Lp:pointer
The name of the variable must be no longer than 20 characters.
5. Class Name:
• You must start with a capital "K" and the following letters reflect the specific meaning, in order to clearly express the purpose and function of the class principle.
• The interface must start with a capital "I" and represent Interface.
• When a name is made up of multiple words, the first letter of each word must be capitalized.
6, structure name, macro name, enumeration name, Union name:
• All uppercase.
• Enumeration name plus lowercase prefix "enum".
Cases:
typedef enum _KFILE_OPEN_MODE
{
enumopen_readonly = 0,
Enumopen_readwrite = 1,
Enumcreate_alway = 3
} Kfile_open_mode;
• Macro name plus lowercase prefix "def".
Cases:
#define DEFMAXNUMBER 100
• The structure name is prefixed with the lowercase prefix "tag" and must be preceded by a capital "K".
Cases:
typedef struct TAGKPOINT
{
int x;
int y;
} Kpoint;
• Union name plus lowercase prefix "uni".
Cases:
typedef Union _variant{
Char Unichval;
int uninval;
Long Unilval;
float Uniftval;
...
} VARIANT;
Windows Naming conventions