Hi, I use cppcheck-1.80 to check the following code
char list[2][3] = { {1,2,3}, {1,2,3} };
class A{ public: char (*pList)[3]; A(){pList = list;}; ~A(){}; };
class B{ public: char (*pList)[3]; B(); ~B(){}; }; B::B(){pList = list;}
, and get
Summary: Member variable 'B::pList' is not initialized in the constructor. Message: Member variable 'B::pList' is not initialized in the constructor.
but I think 'B::pList' is initialized (as A::pList). Is this a bug of cppcheck-1.80? or 'B::pList' is not initialized indeed?
Thanks! It is a false positive. I created http://trac.cppcheck.net/ticket/8170
Log in to post a comment.
Hi,
I use cppcheck-1.80 to check the following code
char list[2][3] = {
{1,2,3},
{1,2,3}
};
class A{
public:
char (*pList)[3];
A(){pList = list;};
~A(){};
};
class B{
public:
char (*pList)[3];
B();
~B(){};
};
B::B(){pList = list;}
, and get
Summary: Member variable 'B::pList' is not initialized in the constructor.
Message: Member variable 'B::pList' is not initialized in the constructor.
but I think 'B::pList' is initialized (as A::pList).
Is this a bug of cppcheck-1.80?
or
'B::pList' is not initialized indeed?
Thanks! It is a false positive. I created http://trac.cppcheck.net/ticket/8170