V654. The condition of loop is always true/false.

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.

Bugs Found

Checked Projects
Collected Errors
14 279
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site. Learn More →