[previous] MISRA C:2012  Rule-13.5:  (Required) [next] The right hand operand of a logical && or || operator shall not contain persistent side effects

Example Code:


#include "misra.h"
#include "m3cmex.h"

static int16_t rule_1305a( int16_t x );

extern int16_t rule_1305( void )
{
   if ( ( s16a > 1 ) && ( s16b++ < 0 ) )                        /* 3415 3440 */
   {
      ++s16r;
   }

   if ( ( s16b > 0 ) || ( rule_1305a( s16a ) != 0 ) )           /* 3415      */
   {
      ++s16r;
   }

   return 1;
}

static int16_t rule_1305a( int16_t x )
{
   return x + x;
}


QAC messages that encompass this guideline:

3415 Right hand operand of '&&' or '||' is an expression with possible side effects.



(c) The Motor Industry Research Association, 2012
QA C Source Code Analyser 8.1.2
MISRA C:2012 Compliance Module 1.0
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents