Kommentar
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Ill-defined for-loop: counts up from maximum
Remarks
This warning indicates that a for-loop might not function as intended.
It occurs when a loop counts up from a maximum, but has a lower termination condition. This loop will terminate only after integer overflow occurs.
Code analysis name: LOOP_COUNTS_UP_FROM_MAX
Example
The following code generates this warning:
void f( )
{
int i;
for (i = 100; i >= 0; i++)
{
// code ...
}
}
To correct this warning, use the following code:
void f( )
{
int i;
for (i = 100; i >= 0; i--)
{
// code ...
}
}