template 클래스의 va_list/va_end에 대해서...
글쓴이: purewell / 작성시간: 토, 2004/11/20 - 4:26오후
template<typename TYPE>
class MyClass
{
public:
void Print(const TYPE* szFmt, ...)
{
va_list vList;
va_start(vList, szFmt);
Print(szFmt, vList);
va_end(vList);
}
};
Print(const char* szFmt, va_list vList) {...}
Print(const wchar_t* szFmt, va_list vList) {...}
위와 같은 코드를 컴파일하면 다음와 같은 오류를 냅니다.
Quote:
#g++ MyClass.cpp
MyClass.h:xx: error: there are no arguments to `va_end' that depend on a template parameter, so a declaration of `va_end' must be available
MyClass.h:xx: error: (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
그래서 다음과 같은 옵션으로 컴파일하면 경고가 뜹니다.
Quote:
#g++ MyClass.cpp -fpermissive
MyClass.h:xx:warning: there are no arguments to `va_end' that depend on a template parameter, so a declaration of `va_end' must be available
무엇이 문제인가요?
* -fpermissive 옵션은 호환되지 않는 코드를 허락해주는 옵션인데,
왠지 모르게 찜찜한 것이....
Forums:


자답입니다.[code:1]#include <cst
자답입니다.
cstdarg를 포함해줬더니 안 그러네요.
_____________________________
언제나 맑고픈 샘이가...
http://purewell.biz
댓글 달기