I have this method and the error is:
\Supp.cpp:35:6: attention : variable 'temp' set but not used [-Wunused-but-set-variable]
I don’t understand why.
void parcourir_index(int * vec){
int i;
int temp;
for (i = 0; i < n; i++) {
temp = vec[i];
}
}
Because temp is a local variable, and there is no reference of it after’temp=vec[i]’, the compiler will consider temp as redundent, and it will be eliminated by a pass called Dead Code Elimination.