I’m currently looking on how to optimise my C code. I found this page which says, in section 10, that pointer address indexing for the for loop would be faster than doing it with the non pointer arithmetic syntax. my question is why and if that’s even still true with all the modern compiler optimisations
If you access members of array like this:
for(int i=0; i<n; i++) nArray[i]=nSomeValue;
Instead of the above code, the following is better:
for(int* ptrInt = nArray; ptrInt< nArray+n; ptrInt++) *ptrInt=nSomeValue;