Примеры ошибок, обнаруженных с помощью диагностики V791
V791. The initial value of the index in the nested loop equals 'i'. Consider using 'i + 1' instead.
LLVM/Clang
V791 The initial value of the index in the nested loop equals 'I'. Perhaps, 'I + 1' should be used instead. LoopUnrollAndJam.cpp 793
static bool checkDependencies(....){
....
for (size_t I = 0; I < NumInsts; ++I) {
for (size_t J = I; J < NumInsts; ++J) {
if (!checkDependency(CurrentLoadsAndStores[I],
CurrentLoadsAndStores[J],
LoopDepth, CurLoopDepth, true, DI))
return false;
....
}
....
}
static bool checkDependency(Instruction *Src,
Instruction *Dst,
....) {
if (Src == Dst)
return true;
....
}
Overgrowth
V791 The initial value of the index in the nested loop equals 'i'. Perhaps, 'i + 1' should be used instead. navmeshhintobject.cpp 65
NavmeshHintObject::NavmeshHintObject()
{
....
for( int i = 0; i < 8; i++ )
{
for( int k = i; k < 8; k++ )
{
if( i != k )
{
if(
corners[i][0] == corners[k][0] ||
corners[i][1] == corners[k][1] ||
corners[i][2] == corners[k][2]
)
{
cross_marking.push_back(corners[i]);
cross_marking.push_back(corners[k]);
}
}
}
}
....
}