The following code violates the MISRA C++ rule 5-0-15: Array indexing shall be the only form of pointer arithmetic.
(1)
void doSomething(const uint8_t *&ptr, size_t num) {
ptr += num;
}
Incrementing any pointer also violates the above rule:
(2)
const uint8_t *ptr = ... ;
*ptr++;
I found a very similar question here, but there the questioner uses arrays. I use pointers.
Is there an alternative notation or other method to add numbers to (1)/ increment (2) pointers to get around this violation?