|
수야 님이 쓰신 글 :
: 헉 #endif 있는데..
:
: //---------------------------------------------------------------------------
:
: #ifndef C_StorageH
: #define C_StorageH
:
: #ifndef STORE_TYPE
: #define STORE_TYPE
: #define TYPE_STRING 1
: #define TYPE_IMAGE 2
:
: class CmdVar
: {
: public :
: int vtype;
: String Value;
: String Name;
: void *Data;
: };
:
: class CB_Storage
: {
: private :
:
: protected :
: TList *Variable;
: C_WinManage *WinMng;
:
: public :
: __fastcall CB_Storage();
: __fastcall ~CB_Storage();
: void __fastcall SetWindowManager(C_WinMAnage* Mng);
: };
:
: //---------------------------------------------------------------------------
:
: class CU_Storage : public CB_Storage
: {
: public :
: };
:
:
: //---------------------------------------------------------------------------
: #endif
:
: 이렇게면 틀리나요?
:
: 임프님 감사합니당~ ^^
:
임펠리테리입니다.
가장 위에 있는 #ifndef는 가장 마지막의 #endif와 한쌍입니다.
#ifndef C_StorageH
#define C_StorageH
...
#endif
어떻게 아느냐구요? 이렇게 쓰는 것은 일종의 관행으로서, 한번 인클루드된 헤더파일의 내용이 다시 중복 선언되지 않게 하기 위해 이렇게 쓰곤 합니다. include 디렉토리와 include/vcl 등 모든 라이브러리 헤더들은 이런식으로 선언해서 중복 선언을 막습니다.
그러니, 그 다음에 나오는 #ifndef 는 #endif 쌍이 없습니다.
원래 헤더파일을 작성한 분이 어떻게 생각했는지 모르겠습니다만, 상식적으로 생각해보면 다음과 같이 되어야 하겠죠.
...
#ifndef STORE_TYPE
#define STORE_TYPE
#endif
...
그럼 참고하시길...
|