1、1Hungarian Notation Basic Order:Prefix-BaseTag-Name-Suffix Prefix: m_ non-static class data members compound s_ static data ( module/function scope ) compound sm_ static class data members compound g_ global variable compound BaseTag: p pointers compound pv pointer to a void argument pp pointer to a
2、 pointerref references compound rg array compound c count of itemsh HANDLE, abstract pointer hr HRESULTb BOOL / bool or other flag bt BYTE (unsigned char)v void ch char/TCHARs short(16 bits) i intl long(32 bits)w WORD (unsigned short) dw DWORD (unsigned long)u any unsigned compound ui UINTul ULONG u
3、s USHORTf float d doublesz CHAR *, string (both null terminated and CString)wsz WCHAR*, Unicode string tsz TCHAR*, Flexible Unicodebstr BSTR/ bstr_t var VARIANT/variant_te enum variable or parametervec vector mat Matrixlst list Suffix:_c constant_t suffix for any type ( including enums)2 Remark.- Co
4、mpound means the prefix or suffix is typically used in combination with additional notations. Combine prefixes in the order .- There is one notable case where Hungarian usually does not add to the readability of code and that is code doing mathematical computations. In this case, simple names such a
5、s x, y, z, i, j, k, etc. can be easier to read and are totally acceptable.Certain abbreviations have become standardabbreviation Wordsrc Sourcedst Destinationrc Rectanglequad Quadrilateralpt Pointtx Textptr Pointerstat Status or statecmd Commandid Identifierwnd Windowbtn Buttonsel Select or Selectio
6、nMember Function NamesWe highly recommend using the following standard prefixes for member function names.Function prefix Type of functionF Query operations that return a boolGet Gets a property.Set or Put Sets a property.CreateDupCreates or duplicates a C+ object. Use “Duplicate” for a method that
7、duplicates the object itself. Objects returned by these functions must be disposed with delete.OnAfterProtected notification methods usually overridden by clients. Where both On and After methods are provided, On is called prior to the event, and After is called after.DrawMoveModifier operations (na
8、med with active verb phrases).Swap Swaps the contents of one object with the contents of another in a way guaranteed to succeed and not throw an exception.For convenience, most useful network addresses and internal websites are listed:Corporate portal site http:/mswMSR Web http:/msrweb/search/mssear
9、ch.aspMSR info web http:/msrinfoInternal Technical Education http:/msteSoftware msrcnxsoftware; bjs-dds-01productsToolbox http:/toolbox/Productivity http:/productivity/Source Depot http:/tools/ToolCenter/SrcDptToolCtr.aspRAID http:/tools/ToolCenter/RaidToolCtr.aspITG web http:/itgweb/Microsoft Public download http:/ http:/