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/

10-13 05:37