I guess I found false positive warning related short circuit logic behavior.
Look at the following code please. It seems that cppcheck don't tke in account b is initialized anyway in left part of the expression.
classA{public:A(){valid=false;value=false;}boolget(bool&v)const{v=value;returnvalid;}voidset(boolv){value=v;valid=true;}private:boolvalue;boolvalid;};intmain(){Aa;a.set(true);// cppcheck says b is uninitializedboolb=a.get(b)&&b;// cppcheck says nothingboolc;boolisOk=a.get(c)&&c;return!isOk;}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I guess I found false positive warning related short circuit logic behavior.
Look at the following code please. It seems that cppcheck don't tke in account
b
is initialized anyway in left part of the expression.No repro with 2.3.