简体   繁体   English

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

[英]expected type-specifier before '…' token

expected type-specifier before '...' token

This is the code 这是代码

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 );
    }
...
}

Now if i get rid of the throw(...) in the above statement this error is resolved.Any suggestions on why Mingw doesnt like throw(...) here ? 现在如果我摆脱了上面的声明中的throw(...),这个错误就解决了。关于Mingw为什么不喜欢throw(...)

Actually, throw(...) is not standard c++ syntax, but a MSVC++ specific extension. 实际上, throw(...)不是标准的c ++语法,而是特定于MSVC ++的扩展。 It just means that this function can throw any exception, which is equivalent to having no exception specification at all, so you can safely remove it. 这仅表示此函数可以引发任何异常,这等效于根本没有异常规范,因此您可以安全地删除它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM