cppcheck 错误与我看到的不匹配



>我运行cppcheck,我收到以下消息: "成员变量 "i_refvec::d ata_"未在 中分配值 'i_refvec::运算符='。">

代码来自模板数字工具包 (TNT)。我想我看到这些变量被初始化了,但我仍然收到投诉。

帮助?

相关函数(从第 155 行开始)如下:

template <class T>
i_refvec<T> & i_refvec<T>::operator=(const i_refvec<T> &V)
{
// Do nothing if we're pointing at ourselves
if (this == &V)
return *this;
if (ref_count_ != NULL)
{
(*ref_count_) --;
if ((*ref_count_) == 0)
destroy();
}
data_ = V.data_;
ref_count_ = V.ref_count_;
if (V.ref_count_ != NULL)
(*(V.ref_count_))++;
return *this;
}

我是 Cppcheck 开发人员。

对我来说,这也看起来像是误报。我想知道您是否可以将其简化为重现问题的简短示例代码..然后在这里报告票证:http://trac.cppcheck.net。

误报通常是由一些微小的细节引起的。可能在其他地方。因此,很难说为什么这会失败。

如果要创建重现误报的示例代码,最好减少原始代码(删除包含、类、方法等)。

相关内容

最新更新