[previous] MISRA C:2012  Rule-13.1:  (Required) [next] Initializer lists shall not contain persistent side-effects

Example Code:


#pragma PRQA_MESSAGES_OFF 2982,2984,3408,3447

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

extern volatile uint16_t v1;

static void f_1301a (uint16_t ap[2]);

extern int16_t rule_1301( void )
{
    /* Non-compliant - volatile access is persistent side-effect */
    uint16_t ax[2] = { v1, 0 };                                 /* 1031           */
    uint16_t bx[2] = { u16a + u16b, u16a - u16b };              /* 1031           */

    /* Non-compliant - two side-effects */
    f_1301a ((uint16_t [2]){u16a++, u16a++});                   /* 1054 3440 3440 */

    return 1;
}

static void f_1301a (uint16_t ap[2])
{
    u16b = ap[0];
    ap[0]++;
}


No QAC messages cover this rule.



(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