The analyzer detected meaningless code computing the distance between the elements of different arrays.
Consider the following example:
ptrdiff_t offset()
{
char path[9] = "test.txt";
char resources[9] = "resr.txt";
return path - resources;
}
Subtracting the addresses of the two arrays allocated on the stack is pointless and very likely to be an error.
To discuss all the suspicious operations involving pointers to arrays, it is convenient to divide pointers into two imaginary groups:
Based on this division, we get a table of operations on pointers to arrays evaluation of which makes no sense (Table 1).
Table 1 – Meaningless pointer operations.
This diagnostic is classified as:
|