Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Arithmetic on Pointers are MISRA compliant ?
#2
ANSWER: MISRA-C Steering Team 5/1/06

Your example is not compliant with 17.4.

Tab is an array type, therefore rule 17.1 is met. Rules 17.1, 17.2 and 17.3 address undefined behaviour issues.
It is recognised that 17.4 is a more restrictive rule than 17.1. Rule 17.1 still applies when rule 17.4 is deviated.

Use either

Code:
tab[2] = 33;
tab[3] = 11;
tab[i+2] = …;

A deviation to rule 17.4 would need to be raised for direct pointer arithmetic on arrays as in your example above.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)