1
일반 텍스트로 매크로 정의에 참여할 수 있습니까?동적 변수 이름 : 매크로 연결 매크로 텍스트로 정의
예 :
#define T_NAME Text_Int
#define MAP_KEYS T_NAME _Map_Keys // defined in a separate header file "a.h"
// I am hoping MAP_KEYS = Text_Int_Map_Keys
그래서 그때 갈 수
#undef T_NAME
#undef MAP_KEYS
#define T_NAME Text_Real
#define MAP_KEYS T_NAME _Map_Keys
#undef T_NAME
#undef MAP_KEYS
#define T_NAME Text_Short
#define MAP_KEYS T_NAME _Map_Keys
왜 매크로를 사용합니까? 전처리 기는 인자로 간단한 텍스트 치환으로'#define'을 처리합니다. 이는 실제 문제에 대한 적절한 접근 방법이 아닙니다. –