CS440 Hungarian Notation
Variable = prefix + basetype + qualifier
Function = return basetype (in caps) + qualifier
Prefixes Basetypes Qualifiers
p - pointer f - boolean flag First - 1st element in a set
lp - long pointer ch - single byte character Last - last element in a set
hp - huge pointer w16 - signed min word size Min - always 1st actual element
rg - array w32 - Mic - current 1st element
i - index b8 - signed min byte size Max - upper limit (not valid value)
c - count u16 - usigned min word size Mac - current upper limit in a set
d - difference u32 - Sav - temporarily saved value
h - handle r - single precision real T - temporary value quickly disposed of
g - global variable d - double precision real Src - a source operand
s - static variable bit - single bit Dest - a destination operand
v - void
st - Pascal-type string
sz - null terminated string
w - signed word where size doesn't matter
u - unsigned word where size doesn't matter
Examples of variable and function names:
pch - pointer to a character
ich - index into a character array
rgsz - array of null terminated strings
pszSrc - pointer to a zero terminated source string
cch - count of characters
FGetTokens - boolean function returning token pointers
puMic - pointer to the current first element (pointer is unsigned and size doesn't matter)
Examples of code:
String Copy:
---------------------------------------------
void VStrCpy (char *pszSrc, char *pszDest)
{
while (*pszDest++ = *pszSrc++);
}
Free elements on a linked list:
---------------------------------------------
void VFreeList (NodePtr *puList)
{
NodePtr puFirst = *puList,
puT;
for (; puFirst != NULL; puFirst = puT)
{
puT = puFirst->puNext;
free (*puFirst);
}
puList = NULL;
}