'헝가리안표기법'에 해당되는 글 1건

  1. 2008.05.02 헝가리안 코드 명명법
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

헝기리안 표기법 정리

Hungarian Notation


Format

x_xXxxxxxx
0123456789
0 : 변수의 위치를 지정한다. g(전역변수), m(멤버변수), 없음(지역변수)
1 : 0 위치에 g 나 m 을 지정한 경우 _ 을 기술한다.
2 : 자료형의 종류를 나타낸다.(클래스 이름에 대해서는 관습적으로 자음축약형을 사용한다._
3 ~ : 변수의 의미 있는 이름을 기술하며, 3 위치는 대문자를 사용한다. 변수 이름이 너무 긴 경우 자음만을 기술한다.

Examples
int g_nCnt : 정수형 글로벌 카운터 unsigned char ucByte; :한 바이트 데이타 char cChar; :한 문자 unsigned char rgucByte[10]; :바이트 데이타 10개 char rgcChar[10]; :문자 데이터 10개 char szChar[16 +1]; :문자 16개를 저장할 수 있는 문자열 공간



Table

Prefix Type Description Example
b bool any boolean type bool bTrue;
c char character type char cLetter;
i int integer for index int iCars;
n int number, quantity int nNum;
l long long type long lDistance;
u unsigned unsigned type(4byte) unsigned uPercent
w WORD unsigned word(2byte) WORD wCnt
dw DWORD unsigned double word(4byte) DWORD dwLength
d double double floating point double dPercent;
f float floating point float fPercent;
s static a static variable static short ssChoice;
rg array stands for range float rgfTemp[16];
p * any pointer int *piAddr;
sz * null terminated string of characters char szText[16];
pfn * function pointer int (*pifnFunc1)(int x, int y);
t struct a user defined type ...
e enum variable which takes enumerated values ...
E enum Enumerated type ...
g_ Global Global Variable String *g_psBuffer;
m_ Member class private member variable int m_iMember;
k constant formal parameter ... void vFunc(const long klGalaxies)
r reference formal parameter ... void vFunc(long &rlGalaxies)
str String string class(C++) String strName;
prg ... dynamically allocated array char *prgGrades;
h handle handle to something hMenu
x/y ... used as size int xWitdth, yHeight;

Posted by shunman
,