1 : 0 위치에 g 나 m 을 지정한 경우 _ 을 기술한다.
2 : 자료형의 종류를 나타낸다.
n, i : 정수형(n 은 카운트 목적, i 는 인덱스 목적)
l : long 형 (과거 int 와 구분하기 위해서 사용했다.)
u : 부호없는 정수형
w : 부호없는 2 byte 정수형
dw : 부호없는 4 byte 정수형
p : 포인터 타입
f, d : 실수형(f 는 float, d 는 double)
sz : char 배열(문자열 표현)
클래스 이름에 대해서는 관습적으로 자음축약형을 사용한다.
3 ~ : 변수의 의미 있는 이름을 기술하며, 3 위치는 대문자를 사용한다. 변수 이름이 너무 긴 경우 자음만을 기술한다.
예) g_nCnt
Examples
bBusy
: booleanchInitial
: charcApples
: count of itemsdwLightYears
: double word (systems)fBusy
: boolean (flag)nSize
: integer (systems) or count (application)iSize
: integer (systems) or index (application)fpPrice
: floating-pointdbPi
: double (systems)pFoo
: pointerrgStudents
: array, or rangeszLastName
: zero-terminated stringu32Identifier
: unsigned 32-bit integer (systems)stTime
: clock time structurefnFunction
: function name
The mnemonics for pointers and arrays, which are not actual data types, are usually followed by the type of the data element itself:
pszOwner
: pointer to zero-terminated stringrgfpBalances
: array of floating-point valuesaulColors
: array of unsigned long (systems)
While Hungarian notation can be applied to any programming language and environment, it was widely adopted by Microsoft for use with the C language, in particular forMicrosoft Windows, and its use remains largely confined to that area. In particular, use of Hungarian notation was widely evangelized by Charles Petzold's "Programming Windows", the original (and for many readers, the definitive) book on Windows API programming. Thus, many commonly-seen constructs of Hungarian notation are specific to Windows:
- For programmers who learned Windows programming in C, probably the most memorable examples are the
wParam
(word-size parameter) andlParam
(long-integer parameter) for the WindowProc() function. hwndFoo
: handle to a windowlpszBar
: long pointer to a zero-terminated string
The naming convention guidelines for .NET Framework, Microsoft's more recent software development platform, advise that Hungarian notation should not be used.[2]
The notation is sometimes extended in C++ to include the scope of a variable, separated by an underscore. This extension is often also used without the Hungarian type-specification:
g_nWheels
: member of a global namespace, integerm_nWheels
: member of a structure/class, integerm_wheels
: member of a structure/classs_wheels
: static member of a class_wheels
: local variable
'My Study > Programming&Theory' 카테고리의 다른 글
Hardware Manipulation ( Keyboard LED ) (0) | 2010.12.15 |
---|---|
Driver에서 시스템 스레드 사용하기 ( 동기화 이벤트 오브젝트 ) (0) | 2010.12.14 |
멀티태스킹 기반 데몬 서버 ( linux ) (0) | 2010.12.06 |
DeviceIoControl로 디바이스와 연결 (9) | 2010.11.13 |
EXPORT Table에서 함수 주소 얻기 (0) | 2010.11.01 |