The analyzer has detected a situation when division by zero may occur.
Consider this sample:
for (int i = -10; i != 10; ++i)
{
Foo(X / i);
}
While executing the loop, the 'i' variable will acquire a value equal to 0. At this moment, an operation of division by zero will occur. To fix it we need to specifically handle the case when the 'i' iterator equals zero.
This is the correct code:
for (int i = -10; i != 10; ++i)
{
if (i != 0)
Foo(X / i);
}
This diagnostic is classified as:
|
You can look at examples of errors detected by the V609 diagnostic. |
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!