The analyzer has detected a potential error: odd initial and finite counter values are used in the 'for' operator. It may cause incorrect loop execution and break the program execution logic.
Consider the following example:
signed char i; for (i = -10; i < 100; i--) { ... };
Perhaps there is a misprint here causing the initial and finite values to be mixed up. The error may also occur if operators '++' and '--' are mixed up.
This is the correct code:
for (i = -10; i < 100; i++) { ... };
The following code is also correct:
for (i = 100; i > -10; i--) { ... };
Consider the following code sample found by the analyzer in a real application:
void CertificateRequest::Build() { ... uint16 authCount = 0; for (int j = 0; j < authCount; j++) { int sz = REQUEST_HEADER + MIN_DIS_SIZE; ... } }
The 'authCount' variable is initialized by an incorrect value or perhaps there is even some other variable to be used here.
This diagnostic is classified as:
|
You can look at examples of errors detected by the V621 diagnostic. |