#include #define false 0 #define true 1 typedef _Bool bool_t; uint8_t f ( void ); void example ( void ) { uint8_t x, y, a[ 3 ], b, c; bool_t bool_var; /* ----------------- Example code from MISRA C:2012 begin ----------------- */ x = y; /* Compliant */ a[ x ] = a[ x = y ]; /* Non-compliant */ if ( bool_var = false ) /* Non-compliant */ { } if ( ( 0u == 0u ) || ( bool_var = true ) ) /* Non-compliant */ { } if ( ( x = f ( ) ) != 0 ) /* Non-compliant */ { } a[ b += c ] = a[ b ]; /* Non-compliant */ x = b = c = 0; /* Non-compliant */ /* ------------------ Example code from MISRA C:2012 end ------------------ */ }