The analyzer has detected an issue when the condition in the 'for' or 'while' operator is always true or always false. It usually indicates presence of errors. It's highly probable that the programmer made a misprint when writing the code and this fragment should be examined.
Consider an example of incorrect code:
for (i = 0; 1 < 50; i++)
{ .... }
There is a misprint there. In the condition, the constant '1' is written instead of the 'i' variable. This code is easy to fix:
for (i = 0; i < 50; i++)
{ .... }
The analyzer won't generate the warning message if the condition is defined explicitly as a constant expression '1' or '0', 'true' or 'false'. For example:
while (true)
{ .... }
This diagnostic is classified as:
You can look at examples of errors detected by the V654 diagnostic. |