windows程序设计 匈牙利命名法

来源:互联网 发布:视知传媒 编辑:程序博客网 时间:2024/05/16 14:56

Hungarian Notation

Hungariannotation helps you avoid errors in your code before they turn into bugs.Because the name of a variable describes both the use of a variable and itsdata type, you are much less likely to make coding errors involving mismatcheddata types.

The variablename prefixes I'll generally be using in this book are shown in the followingtable.

Prefix

Data Type

c

char orWCHAR or TCHAR

by

BYTE (unsignedchar)

n

short

i

int

x, y

int used asx-coordinate or y-coordinate

cx, cy

int used asx or y length; c stands for "count"

bor f

BOOL (int);f stands for "flag"

w

WORD(unsigned short)

l

LONG (long)

dw

DWORD(unsigned long)

fn

function

s

string

sz

stringterminated by 0 character

h

handle

p

pointer

0 0