2009年8月13日 星期四

匈牙利命名法 (For reference)

匈牙利命名法
變數名稱 = 屬性+類型+描述
屬性
" g_ 全域變數
" c_ 常數
" m_ 成員變數
類型
" n/ui int/unsigned int
" l/ ul long/unsigned long
" sh/us short/unsigned short
" f float
" d double
" ld long double
" ch char
" b boolean
" p pointer
" h handle
" str String
" w/dw WORD/DWORD
" b byte/unsigned char
" bl BOOL
描述
" Custom 自訂
" Src 來源
" Dst 目的
" Tmp 暫時

Other Reference:

Prefix

Data Type

Prefix

Data Type

c

char, TCHAR

bt

TBYTE, BYTE,

uc

UCHAR



s

short

us

USHORT

w

WORD

n

int, INT

u

UINT

l

LONG, long

dw

DWORD

ul

ULONG

fl

float

db

double

b

BOOL

f

bitwise flag fields

sz

ANSI string, terminated with a \0 character.

psz

PSTR

h

HANDLE

hmem

HGLOBAL, HLOCAL

hwnd

HWND

hfile

HFILE

hdc

HDC

hpen

HPEN

hfont

HFONT

hbmp

HBITMAP

hpal

HPALETTE

hmenu

HMENU

hicon

HICON

hinst

HINSTANCE

hcur

HCURSOR

hbr

HBRUSH

pt

POINT

rc

RECT

tm

TEXTMETRIC

lf

LOGFONT

bmp

BITMAPINFO

pal

PALETTEENTRY

cls

WNDCLASS

msg

MSG

rgb

RGBQUAD

clr

COLORREF

of

OFSTRUCT

ps

PAINTSTRUCT

cb

count of bytes

cx, cy

length in pixels

p

added for pointer to any type, e.g., ps, pdw, phicon, pof, ..., etc.

a

added for array of any type, e.g., as, adw, auc, ...

C

a big C in front of all C++ class names, the rest of the class name is a mix of big and small letters

m_

added in front of all C++ class member variables.

str

string



st

structure




沒有留言: