E D R , A S I H C RSS

헝가리안표기법

Hungarian Notation(표기법)
10, 15년전 Microsoft의 개발자중 헝가리 사람의 프로그래머가 쓰던 변수 명명법. MS내부에서 따라쓰기 시작하던 것이 점차 전세계의 프로그래머들에게 널리 퍼져 이젠 프로그램 코딩시 변수 명명의 표준적인 관례가 되었다.
그러나 실제로 현장에서 일하다 보면 헝가리안 표기법을 제대로 지키는 개발자는 그리 많지 않다. 어느정도 개발경험을 가지고 있는 프로그래머는 물론 심지어 시중의 프로그래밍 서적에서 조차 저자마다 변수명을 개인에 따라 가지각색으로 짓고 있어서 처음 프로그램을 배우는 입문자들들이 변수 명명에 대한 기준을 제대로 잡지 못하고 있는 실정이다.
솔직히 필자도 얼마전까지 이런 변수 명명에 대한 관례를 잘 지키지 않았다. 그러나 변수 명명에 관한 표준화된 관례를 지켜주면 코드의 가독성을 높여줄 뿐 아니라 예를 들어 카운터 변수를 count라고 지을지 cnt라고 지을지 고민하지 않아도 되는 편리함을 누릴 수 있다. - 출처
------
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 rgfTemp16
p * any pointer int *piAddr
sz * null terminated string of characters char szText16
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
------
도구분류
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:31:32
Processing time 0.0183 sec