-
Hungarian notation
Hungarian notation is an identifier naming convention in computer programming, in which the name of a variable or function indicates its intention or kind, and in some dialects its type.
The original Hungarian Notation is sometimes called Apps Hungarian as it became popular in the Microsoft Apps division in the development of Word, Excel and other apps.
-
History
The original Hungarian notation, which would now be called Apps Hungarian, was invented by Charles Simonyi, a programmer who worked at Xerox PARC circa 1972-1981, and who later became Chief Architect at Microsoft.
PARC(Palo Alto Research Center, formerly Xerox PARC) is a research and development company in Palo Alto, Califonia. Formed in 1969.
-
Coding Style Concentions From Microsoft
From Microsoft, Hungarian Notation has become a common coding practice in Win32 programming. They include variable prefix notations that give to variable names a suggestion of the type of the variable.
The following table lists common prefixes:
Prefix Description a Array b BOOL (int) c Char cb Count of bytes cr Color reference value cx Count of x (short) dw DWORD (unsigned long) f Flags (usually multiple bit values) fn Function g_ Global h Handle i Integer l Long lp Long pointer m_ Data member of a class n Short int p Pointer s String sz Zero terminated String tm Text metric u Unsigned int ul Unsigned long (ULONG) w WORD (unsigned short) x,y x, y coordinates (short) Much more information could be found here.
-
Refrecences
- StackOverflow Tag: Hungarian notation
- Good Examples of Hungarian Notation? [closed]
- .NET General Naming Conventions
- Making Wrong Code Look Wrong
- Why shouldn’t I use “Hungarian Notation”?
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/257361.html
標籤:其他
上一篇:C語言編程>第二十四周 ③ 給定程式的功能是將m個人的考試成績進行分段統計,考試成績放在score陣列中,各分段的人數存到a陣列中:
下一篇:643.子陣列最大平均數 I
