Hungarian notation is a naming convention in computer programming that indicates either the type of object or the way it should be used. It was originally proposed by Charles Simonyi, a programmer at Xerox PARC in the early 1980s. There are two variations of Hungarian notation: Systems and Apps. They both involve using a special prefix as part of the name to indicate an object's nature.
Systems Hungarian notation
In Systems Hungarian notation, the prefix represents the actual data type of the object. For instance, if the object named Greeting were a zero-terminated string, its Systems Hungarian name might be szGreeting. Or, if the object YesOrNo were a boolean variable, its Systems Hungarian name would be bYesOrNo.
Apps Hungarian notation
In Apps Hungarian notation, the prefix represents the logical data type, which gives an indication of the object's purpose. For instance, an "unsafe" (unsanitized) string might have the prefix us, and a variable used for counting might be prefixed with n.
Hungarian notation prefixes
The prefix used is up to the programmer, but standard prefixes include:
- b for boolean
- ch for char
- w for word
- dw for double word
- i for integer
- f or fp for floating-point
- d or db for double-precision floating point
- p for pointer
- u32 for unsigned 32-bit integer
- fn for function