From the C++ Standard:
The expression E1[E2] is identical (by definition) to *((E1)+(E2)).
Sometime pointer arithmetics code is evidently cleaner than "subsripted" one:
int countDigits(const char* str)
{
int n = 0;
if (str)
while (int c = *str++)
if (c >= '0' && c <= '9')
++n;
return n;
}
Sometimes we have no choice: as usually (but not always) pointer arithmetics code is faster than "subscripted" one on embedded systems where we (often) must save on every microsecond...
It's a far-fetched problem. It's not a language problem...