求大神指点。。使用PC—lint扫面代码中析构的异常问题。
公司代码需要使用PC-lint扫描,其中有一个错误提示和代码如下,
error 1551: (Warning -- Function may throw exception '...' in destructor
iub_mempool::~iub_mempool()
if (m_pstart)
{
delete[] m_pstart;
m_pstart = NULL;
}
if (m_pool)
{
delete[] m_pool;
m_pool = NULL;
}
if (IubLock)
{
delete[] IubLock;
IubLock = NULL;
}
更改为:
iub_mempool::~iub_mempool()
try
{
if (m_pstart)
{
delete[] m_pstart;
m_pstart = NULL;
throw 1;
}
if (m_pool)
{
delete[] m_pool;
m_pool = NULL;
throw 2;
}
if (IubLock)
{
delete[] IubLock;
IubLock = NULL;
throw 3;
}
}
catch (int ex) {}
后提示下面的错误。
error 1559: (Warning -- Uncaught exception '...' may be thrown in destructor '
求各位大神指点啊。。怎么能消除这个警告啊。