I was trying to create some example code in Microsoft Visual Studio which looks like that
int main()
{
const size_t size = 10;
int arr[size];
for (size_t i = 0; i < size; ++i)
arr[i] = i;
return 0;
}
Now JetBrains ResharperC++ emits the following warning in line arr[i] = i;
Do not use array subscript when the index is not an integer constant expression; use gsl::at() instead
I fail to understand what I this means and how to resolve this warning.
As this is a scheme I was using fairly often, I am a little concerned about the warning.
Could anyone advice or point me in the right direction?
EDIT: Changing the loop to:
for (size_t i = 0; i < size; ++i)
arr[i] = 0;
still produces the warning.