/* >>>------------------------------------------------------------ * * File: rule_12.3.c, Module: M2CM-3.2-QAC-8.1.2 * * RULE 12.3 (Required): * The sizeof operator shall not be used on expressions that * contain side effects. * * Implemented by message: * 3307 The operand of 'sizeof' is an expression with implied * side effects, but they will not be evaluated. * * <<<------------------------------------------------------------ */ /*PRQA S 2984,3470 ++ */ #include "misra.h" #include "m2cmex.h" static PC * test_1203a( void ); extern S16 test_1203( void ) { U16 x; U16 u = 1U; U16 v = 2U; S16 r; x = sizeof( S16 ); x = x + sizeof( u ); x = x + sizeof( u++ ); /* MISRA Violation */ x = x + sizeof( test_1203a() ); /* MISRA Violation */ x = x + sizeof( u + v ); /* MISRA Violation ? */ r = (S16)x + (S16)u + (S16)v; return r; } static PC * test_1203a( void ) { return "ABC"; }