“...”标记之前的预期类型说明符

expected type-specifier before '...' token

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(...) 这个错误是 resolved.Any 关于为什么 Mingw 不喜欢这里 throw(...) 的建议?

实际上,throw(...)不是标准的c++语法,而是MSVC++特定的扩展。只是说明这个函数可以抛出任何异常,相当于完全没有异常规范,所以可以放心的去掉。