Examples
bBusy
: booleanchInitial
: charcApples
: count of itemsdwLightYears
: double word (Systems)fBusy
: boolean (flag)nSize
: integer (Systems) or count (Apps)iSize
: integer (Systems) or index (Apps)fpPrice
: floating-pointdbPi
: double (Systems)pFoo
: pointerrgStudents
: array, or rangeszLastName
: zero-terminated stringu32Identifier
: unsigned 32-bit integer (Systems)stTime
: clock time structurefnFunction
: function name
The mnemonics for pointers and arrays, which are not actual data types, are usually followed by the type of the data element itself:
pszOwner
: pointer to zero-terminated stringrgfpBalances
: array of floating-point valuesaulColors
: array of unsigned long (Systems)
While Hungarian notation can be applied to any programming language and environment, it was widely adopted by Microsoft for use with the C language, in particular for Microsoft Windows, and its use remains largely confined to that area. In particular, use of Hungarian notation was widely evangelized by Charles Petzold's "Programming Windows", the original (and for many readers, the definitive) book on Windows API programming. Thus, many commonly seen constructs of Hungarian notation are specific to Windows:
- For programmers who learned Windows programming in C, probably the most memorable examples are the
wParam
(word-size parameter) andlParam
(long-integer parameter) for the WindowProc function. hwndFoo
: handle to a windowlpszBar
: long pointer to a zero-terminated string
The notation is sometimes extended in C++ to include the scope of a variable, separated by an underscore. This extension is often also used without the Hungarian type-specification:
g_nWheels
: member of a global namespace, integerm_nWheels
: member of a structure/class, integerm_wheels
,_wheels
: member of a structure/classs_wheels
: static member of a classc_wheels
: static member of a function
Read more about this topic: Hungarian Notation
Famous quotes containing the word examples:
“There are many examples of women that have excelled in learning, and even in war, but this is no reason we should bring em all up to Latin and Greek or else military discipline, instead of needle-work and housewifry.”
—Bernard Mandeville (16701733)
“In the examples that I here bring in of what I have [read], heard, done or said, I have refrained from daring to alter even the smallest and most indifferent circumstances. My conscience falsifies not an iota; for my knowledge I cannot answer.”
—Michel de Montaigne (15331592)
“It is hardly to be believed how spiritual reflections when mixed with a little physics can hold peoples attention and give them a livelier idea of God than do the often ill-applied examples of his wrath.”
—G.C. (Georg Christoph)