expected type-specifier before '...' token
这是代码
template< typename T, int t_nFixedBytes = 128, class Allocator = CCRTAllocator >
class CTempBuffer
{
public:
CTempBuffer() throw() :
m_p( NULL )
{
}
CTempBuffer( size_t nElements ) throw( ... ) : <---ERROR HERE
m_p( NULL )
{
Allocate( nElements );
}
...
}
现在,如果我去掉上面语句中的 throw(...),这个错误就解决了。关于为什么 Mingw 不喜欢这里的 throw(...)
有什么建议吗?
最佳答案
实际上,throw(...)
不是标准的 c++ 语法,而是 MSVC++ 特定的扩展。它只是意味着这个函数可以抛出任何异常,相当于完全没有异常规范,所以你可以安全地删除它。
关于c++ - '...' token 之前的预期类型说明符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29088566/