-
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
理解Hungarian notation
最新推荐文章于 2025-05-10 02:37:04 发布
匈牙利命名法,由Charles Simonyi在1970年代发明,最初在Xerox PARC使用,后来在微软的Windows应用程序开发中流行。这种命名约定通过变量名指示其意图、类型或特性。例如,'a'表示数组,'b'表示BOOL,'i'表示整数等。然而,关于是否应使用匈牙利命名法存在争议,一些观点认为它增加了代码的阅读难度。

791

被折叠的 条评论
为什么被折叠?



