我运行cppcheck并收到此消息: "会员变量 ' i_refvec ::数据_'未分配值 ' 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;
}
答案 0 :(得分:0)
我是Cppcheck开发人员。
对我来说,这似乎也是一种误报。我想知道你是否可以将它缩减为一个简短的示例代码来重现问题..然后在这里报告一张票:http://trac.cppcheck.net。
误报往往是由一些微小的细节引起的。可能在其他地方。因此,很难说为什么会失败。
如果您想创建一个重现误报的示例代码,最好减少原始代码(删除包含,类,方法等)。