The analyzer has detected a code that can be simplified. A function code contains local variables which are not used anywhere.
The analyzer generates this warning in the following cases:
The analyzer doesn't generate the warning if variables of built-in types are created: the compiler handles this very well. It also helps to avoid a lot of false positives.
Consider this sample:
void Foo()
{
int A[100];
string B[100];
DoSomething(A);
}
The array of items of the 'string' type is declared but not used, while it still requires memory to be allocated for it and calling constructors and destructors. To optimize this code, we just need to delete the declaration of the unused local variable or array. This is the fixed code:
void Foo()
{
int A[100];
DoSomething(A);
}