1、Hungarian 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]:
2、 p pointers [compound ] pv pointer to a void argument pp pointer to a pointer ref references [ compound ] rg array [ compound ] c count of items h HANDLE, abstract pointer hr HRESULT b BOOL / bool or other flag bt BYTE (unsigned char) v void ch char/TCHAR
3、 s short(16 bits) i int l long(32 bits) w WORD (unsigned short) dw DWORD (unsigned long) u any unsigned [ compound ] ui UINT ul ULONG us USHORT f float d double sz CHAR *, string (both null terminated and CString) wsz WCHAR*, Unicode string tsz TCHAR*, F
4、lexible Unicode bstr BSTR/ bstr_t var VARIANT/variant_t e enum variable or parameter vec vector mat Matrix lst list • [Suffix]: _c constant _t suffix for any type ( including enum’s) • Remark. -- Compound means the prefix or suffix is typically used in comb
5、ination with additional notations. Combine prefixes in the order
6、j, k, etc. can be easier to read and are totally acceptable. Certain abbreviations have become standard abbreviation Word src Source dst Destination rc Rectangle quad Quadrilateral pt Point tx Text ptr Pointer stat Status or state cmd Command id Identifier wnd Window btn
7、 Button sel Select or Selection Member Function Names We highly recommend using the following standard prefixes for member function names. Function prefix Type of function F… Query operations that return a bool Get… Gets a property. Set… or Put… Sets a property. Create… Dup… Creates o
8、r duplicates a C++ object. Use “Duplicate” for a method that duplicates the object itself. Objects returned by these functions must be disposed with delete. On… After… Protected notification methods usually overridden by clients. Where both On and After methods are provided, On is called prior to
9、 the event, and After is called after. Draw… Move… Modifier operations (named 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 w
10、ebsites are listed: Corporate portal site http://msw MSR Web http://msrweb/search/mssearch.asp MSR info web http://msrinfo Internal Technical Education http://mste Software \\msrcnx\software; \\bjs-dds-01\products Toolbox http://toolbox/ Productivity http://productivity/ Source Depot http://tools/ToolCenter/SrcDptToolCtr.asp RAID http://tools/ToolCenter/RaidToolCtr.asp ITG web http://itgweb/ Microsoft Public download MSDN 2






