Hungarian nomenclature
The naming rules of the variable (also included macro), the comparison system and the thorough Hungarian nomenclature used in Windows programming. The Hungarian nomenclature is identified as a prefix by adding a corresponding lowercase letter to the corresponding lowercase letter, and identifies the scope of the variable. These symbols can be used in multiple simultaneous use, the order is the first m_ (member variable), then the pointer, the simple data type, and then other. For example: M_Lpszstr, indicating a long pointer member variable pointing to a string ending with 0 characters.
A little interest in the Hungarian nomenclature is the origin of its name. This naming technology is made by a dried Microsoft programmer Charles Simonyi, who is born in Hungary. People working with him in Microsoft companies were used by church using this convention. This is normal for them. But for those other than those led by Simonyi, they feel very strange. They think this is the expression of the deadboard, and even this strange look is because it is written in Hungary. Since then, this naming method is called Hungarian nomenclature.
The key to the Hungarian nomenclature is that the name of the identifier is prefixed by one or more lowercase letters; the prefix is a word or multiple word combinations of the initial copy, the word to indicate the use of variables.
Prefix prefix prefix prefix with lowercase letters in Hungarian nomenclature
Types of
a
Array (Array)
b
Boolean (Boolean)
BY
Byte (Byte)
c
Symbolic characters (char)
CB
No symbolic characters (char BYTE, no more people)
CR
Color reference value (ColorRef)
CX, CY
Sittrack (length ShortInt)
DW
Double word
FN
function
hide
Handle
i
Integrity
l
Long Int
LP
Long Pointer
M_
Member of the class
n
SHORT INT
NP
Near Pointer
p
Pointer
s
String type
SZ
String with Zero End with NULL
w
Word
However, in any case, it is hard to use Hungarian nomenclature to use the Hungarian nomenclature. Especially UNIX programming, in using no variable name, keyword automatic complement function, such as VI, the variable name that is knocked into the uppercase mixing is painful. In fact, as long as you pay attention to two principles: 1) The meaning is clear, not easy to confusion; 2) Do not conflict with other modules, system API's namespace conflicts. 1. Consciously a variable name, macro name plus the keywords of this module, no conflict with other modules, system API's namespace; for example: macro's name is too short, such as: "debug" or "_debug" It is likely to conflict with other modules, system modules; 2. Local variables, especially in cyclic variables, usage of I, J, K, no problem; 3. Macro, constant, enumeration enum, all uppercase letters; 4. Global variables plus the prefix "G", follow the words of the first letters above; global variables, can understand
Naming Code for MFC, handle, control and structure of Hungarian nomenclature
Windows type
Sample variable
MFC class
Sample variable
HWnd
HWnd;
CWND *
PWND;
HDLG
HDLG;
CDIALOG *
PDLG;
HDC
HDC;
CDC *
PDC;
HgDiobj
HgDiobj; cgdiobject *
PgDiobj;
HPEN
HPEN
CPEN *
Ppen;
Hbrush
Hbrush;
CBRUSH *
PBRUSH;
Hfont
HFont;
Cfont *
PFont;
Hbitmap
Hbitmap;
CBitmap *
Pbitmap;
HPALETTE
HPALTTE;
CPALETTE *
PPALETTE;
HRGN
HRGN;
CRGN *
PRGN;
Hmenu
HMENU;
Cmenu *
PMenu;
HWnd
HCTL;
CState *
PState;
HWnd
HCTL;
CButton *
Pbutton;
HWnd
HCTL;
Cedit *
Pedit;
HWnd
HCTL;
Clistbox *
Plistbox;
HWnd
HCTL;
CCOMBOBOX *
PCOMBOBOX;
HWnd
HCTL;
Cscrollbar *
Pscrollbar;
HSZ
Hszstr;
Cstring
PSTR;
Point
PT;
Cpoint
PT;
Size
Size;
CSIZE
Size;
RECT
RECT;
CRECT
RECT;
General prefix naming specification
Prefix
Types of
Example
C
Class or structure
CDocument, CprintInfo
M_
Member variables
m_pdoc, m_ncustomers
Guan Hungarian nomenclatrifies (also included macro) naming rules, compare systems and thoroughly have Hungarian nomenclature used in Windows programming. The Hungarian nomenclature is identified as a prefix by adding a corresponding lowercase letter to the corresponding lowercase letter, and identifies the scope of the variable. These symbols can be used in multiple simultaneous use, the order is the first m_ (member variable), then the pointer, the simple data type, and then other. For example: M_Lpszstr, indicating a long pointer member variable pointing to a string ending with 0 characters.
A little interest in the Hungarian nomenclature is the origin of its name. This naming technology is made by a dried Microsoft programmer Charles Simonyi, who is born in Hungary. People working with him in Microsoft companies were used by church using this convention. This is normal for them. But for those other than those led by Simonyi, they feel very strange. They think this is the expression of the deadboard, and even this strange look is because it is written in Hungary. Since then, this naming method is called Hungarian nomenclature.
The key to the Hungarian nomenclature is that the name of the identifier is prefixed by one or more lowercase letters; the prefix is a word or multiple word combinations of the initial copy, the word to indicate the use of variables.
Prefix prefix prefix prefix with lowercase letters in Hungarian nomenclature
Types of
a
Array (Array)
b
Boolean (Boolean)
BY
Byte (Byte)
c
Symbolic characters (char)
CB
No symbolic characters (char BYTE, no more people)
CR
Color reference value (ColorRef)
CX, CY
Sittrack (length ShortInt)
DW
Double word
FN
function
hide
Handle
i
Integrity
l
Long Int
LP
Long Pointer
M_
Member of the class
n
SHORT INT
NP
Near Pointer
p
Pointer
s
String type
SZ
String with Zero End with NULL
w
Word
However, in any case, it is hard to use Hungarian nomenclature to use the Hungarian nomenclature. Especially UNIX programming, in using no variable name, keyword automatic complement function, such as VI, the variable name that is knocked into the uppercase mixing is painful. In fact, as long as you pay attention to two principles: 1) The meaning is clear, not easy to confusion; 2) Do not conflict with other modules, system API's namespace conflicts. 1. Consciously a variable name, macro name plus the keywords of this module, no conflict with other modules, system API's namespace; for example: macro's name is too short, such as: "debug" or "_debug" It is likely to conflict with other modules, system modules; 2. Local variables, especially in cyclic variables, usage of I, J, K, no problem; 3. Macro, constant, enumeration enum, all uppercase letters; 4. Global variables plus the prefix "G", follow the words of the first letters above; global variables, can understand
Naming Code for MFC, handle, control and structure of Hungarian nomenclature
Windows type
Sample variable
MFC class
Sample variable
HWnd
HWnd;
CWND *
PWND;
HDLG
HDLG;
CDIALOG *
PDLG;
HDC
HDC;
CDC *
PDC;
HgDiobj
HgDiobj;
CGDIObject *
PgDiobj;
HPEN
HPEN
CPEN *
Ppen;
Hbrush
Hbrush;
CBRUSH *
PBRUSH;
Hfont
HFont;
Cfont *
PFont;
Hbitmap
Hbitmap;
CBitmap *
Pbitmap;
HPALETTE
HPALTTE;
CPALETTE *
PPALETTE;
HRGN
HRGN;
CRGN *
PRGN;
Hmenu
HMENU;
Cmenu *
PMenu;
HWnd
HCTL;
CState *
PState;
HWnd
HCTL;
CButton *
Pbutton;
HWnd
HCTL;
Cedit *
Pedit;
HWnd
HCTL;
Clistbox *
Plistbox;
HWnd
HCTL;
CCOMBOBOX *
PCOMBOBOX;
HWnd
HCTL;
Cscrollbar *
Pscrollbar;
HSZ
Hszstr;
Cstring
PSTR;
Point
PT;
Cpoint
PT;
Size
Size;
CSIZE
Size;
RECT
RECT;
CRECT
RECT;
General prefix naming specification prefix
Types of
Example
C
Class or structure
CDocument, CprintInfo
M_
Member variables
m_pdoc, m_ncustomers