I have function that receives an array of pointers like so:
void foo(int *ptrs[], int num, int size)
{
/* The body is an example only */
for (int i = 0; i < size; ++i) {
for (int j = 0; j < num-1; ++j)
ptrs[num-1][i] += ptrs[j][i];
}
}
What I want to convey to the compiler is that the pointers ptrs[i]
are not aliases of each other and that the arrays ptrs[i]
do not overlap. How shall I do this ? My ulterior motive is to encourage automatic vectorization.
Also, is there a way to get the same effect as __restrict__
on an iterator of a std::vector
?
restrict
qualifier from C99 -- its not even a keyword. So any use ofrestrict
in a C++ program is relying on an implementation extension – Retributive