The analyzer has detected an 'if'/ 'while'/'do...while' statement whose conditional expression contains the assignment operator '='. Such constructs often signal the presence of errors. The programmer probably intended to use the '==' operator rather than '='.
Consider the following example:
void func(int x, boolean skip, ...)
{
if (skip = true) {
return;
}
...
if ((x > 50) && (x < 150)) {
...
}
...
}
This code has a typo in it: rather than checking the 'skip' variable, the programmer is changing its value. As a result, the condition will always be true and the 'return' statement will be executed all the time. Fixed code:
if (skip == true){
return;
}
or:
if (skip){
return;
}
This diagnostic is classified as:
|
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders:
Take
a chance!