Thanks for pointing that out, I added a comment on it and support not flagging it.
now that I have permissions again, created https://trac.cppcheck.net/ticket/9420 for this one.
Thanks, that worked
Here is an example I don't like cppcheck flagging with knownConditionTrueFalse void SomeFunctionThatTakesABool(bool hasAttribute) { if(hasAttribute) { } } void ExampleFunction() { const bool hasIt = true; SomeFunctionThatTakesABool(!hasIt); } We really may want to run the negative test at times. In the same function we may call it with the positive case too. I often work around this by making a local non const and changing it's value but that is a waste.
Still waiting to get access back to trac server too.
OK, I found the trick void ExampleFunction() { unsigned int numPoints = 10; // this is required unsigned int pointAIndex = numPoints - 1; for(unsigned int pointBIndex = 0; pointBIndex < numPoints; pointAIndex = pointBIndex++) { } } style: redundantInitialization - Redundant initialization for 'pointAIndex'. The initialized value is overwritten before it is read.
false postive - redendantIntialization on val but val isn't set by loop until after first execution {{{ TEST(LETSSEE, WhatIsTheValue) { const int count = 4; int val = 16; for(int i = 0; i < count; val = i++) { qDebug() << "Val = " << val << " i = " << i; } } }}} Val = 16 i = 0 Val = 0 i = 1 Val = 1 i = 2 Val = 2 i = 3
Same limited permissions issues, not recieving any emails. This is CleanCode, please get me a token or fix this. Thanks