/* >>>------------------------------------------------------------ * * File: rule_17.3.c, Module: M2CM-3.2-QAC-8.1.2 * * RULE 17.3 (Required): * >, >=, <, <= shall not be applied to pointer types except where * they point to the same array. * * Implemented by messages: * 2771 Definite: These pointers address different objects. * * 2772 Apparent: These pointers address different objects. * * <<<------------------------------------------------------------ */ #include "misra.h" #include "m2cmex.h" extern S16 test_1703( void ) { S16 n = 0; static S8 tab1[] = "test1"; static S8 tab2[] = "test2"; S8 * ptr1; S8 * ptr2; ptr1 = &tab1[ u16a ]; ptr2 = &tab1[ u16b ]; if ( ptr1 > ptr2 ) /* OK */ { n = 1; } ptr2 = &tab2[ u16c ]; if ( ptr1 > ptr2 ) /* MISRA Violation */ { n = 1; } return n; }