Hungarian Notation


Hungarian notation is a naming convention that provides type information within the variable name. This is used heavily in Microsoft's code and if you haven't seen it before it can be confusing. However it's quite simple once you understand the concept.
When using Hungarian Notation, a variable name is preceeded by letters that describe it's datatype, this saves you from having to track back and forth through code to find a variable's definition to determine it's datatype.

 b-Boolean value (TRUE or FALSE, 0 or 1)
 c-Char
 dw-Double word
 g-Global
 h-Handle
 i-Integer
 l-Long
 n-Number (int)
 p-Pointer
 s-String (sz = zero terminated string)
 w-Word

Using this notation we can create variable names like lpszTitle, nRecs and ghWin to describe a long pointer to a NULL terminated string, an integer record count and a global handle to a window.
It is worth sticking with hungarian notation and using it in your variable names as it makes your code much more readable when you've used it correctly.

Codehead - 06/04/01

Problems, ideas, better routines ?
Mail me or drop into the forums


Home EMail Forum