0
 > -Severity (Error)
 > -ID(local): 7
 > -Code: UNINIT.CTOR.MUST --> IpuCCAInterfaceBase()
 > -Message: 'this->_remaining_run_kernels_uuids' is not initialized
 > in this constructor.
 > -Details:
 > 
 > 'this->_remaining_run_kernels_uuids' is not initialized in this
 > constructor.
 > 
 > * IpuCCAInterfaceBase.cpp:47: passing 'this' to 'InitializeSaResults'
 > does not initialize 'this->_remaining_run_kernels_uuids'
 > 
 > * IpuCCAInterfaceBase.cpp:47: passing 'this' to 'CreateNVMData'
 > does not initialize 'this->_remaining_run_kernels_uuids'
 > 
 > * IpuCCAInterfaceBase.cpp:143: 'this->_remaining_run_kernels_uuids'
 > is used, but is uninitialized.
 > 
 > Current status 'Analyze'

这是我得到的错误

class COMMON_CCA_INTERFACE IpuCCAInterfaceBase : public ICCAOperations
{
private:

    vector<int> _remaining_run_kernels_uuids;
}

这是头文件

共产党员

IpuCCAInterfaceBase::IpuCCAInterfaceBase()
{
   
}

我们正在使用 klocworks 20.1 解决此错误的推荐方法是什么?

向量将被初始化并稍后在不同的函数中填充。但是加载类时没有数据。

4

1 回答 1

3

也许 Klockwork 要求您显式初始化向量,例如在构造函数初始化列表中:

IpuCCAInterfaceBase::IpuCCAInterfaceBase()
    : _remaining_run_kernels_uuids{ }
{
}

话虽如此,我会认为该消息是误报,因为即使没有这个,向量也应该是隐式默认构造的(并因此被初始化)。

于 2021-11-30T13:51:58.023 回答