CMake

Page Contents

References / useful Links

  • https://critical.eschertech.com/2010/03/03/how-unsafe-is-pointer-arithmetic/

Pointer Manipulation

MISRA C:2004

Rule 17.1 (required): Pointer arithmetic shall only be applied to pointers that address an array or array element.

Rule 17.2 (required): Pointer subtraction shall only be applied to pointers that address elements of the same array.

Rule 17.3 (required): >, >=, <, <= shall not be applied to objects of pointer type, except where they point to the same array

Rule 17.4 (required): Array indexing shall be the only allowed form of pointer arithmetic.

Rule 17.5 (advisory): The declaration of objects shall contain no more than 2 levels of pointer indirection.

MISRA C++:2008

Rule 5-0-15 (required): Array indexing shall be the only allowed form of pointer arithmetic ... [except that] the increment/decrement operators may be used on iterators implemented by pointers to an array.

Rule 5-0-17 (required): Subtraction between pointers shall only be applied to pointers that address elements of the same array.

Rule 5-0-18 (required): >, >=, <, <= shall not be applied to objects of pointer type, except where they point to the same array.

Rule 5-0-19 (required): The declaration of objects shall contain no more than 2 levels of pointer indirection.