News

Copyright © 2008-2019 Paula DiTallo

Tag Cloud



What is "Hungarian Notation" ?

During the heyday of Microsoft's Visual C++ development (read: late 80's - early 90's) this naming convention was talked about a lot. In essence the naming convention prefixes each variable name with letters that denote the data type + a shortened description name -- with each word of the description beginning with a capital letter. Let's say you needed to create a variable that would contain the string value of a book title. You might choose a name like: strBookTitle or maybe just strTitle.

Today, there's a whole lot less talk about the convention--mainly because new standards derived from the Java world and from the .NET world have eclipsed it. However, if for some reason you find yourself delving into a legacy code conversion project written in VC++, you will undoubtedly find yourself immersed in Hungarian Notation!:-)

I almost forgot the key as to why the naming convention is called "Hungarian Notation".  The reason is Hungarian born Dr. Charles Simonyi of Microsoft invented it!:-) As an aside, he was a tourist in space on board Soyuz TMA-10 -- arriving @the International Space Station (ISS) in April, 2007. How cool is that?   

For the record, here's a list of the notation's prefixes:

  • by - byte
  • c - character (single)
  • d - double
  • dw - DWORD (unsigned long)
  • fn - function pointer
  • g_ - global type
  • h - handle
  • hdc - handle to a windows device context
  • hwnd - windows handle
  • i - integer
  • I - interface
  • l - long
  • lp - long pointer
  • lpstr - long pointer to a string
  • m_ - class member
  • n - number or integer
  • p - pointer
  • str - string
  • sz - pointer to 1st character of a "0" terminated string
  • ui - unsigned integer
  • v - void
  • w - WORD  (unsigned short)
  • X - Nested class
  • x - instantiation of a nested class
Saturday, January 26, 2008 11:28 AM

Feedback

# re: What is "Hungarian Notation" ?

in hungarian notation displayn the list of all notation which are used in windows programming 2/6/2009 10:14 PM | rupali

Post A Comment
Title:
Name:
Email:
Comment:
Verification: