![]() |
|
MISRA C:2012 Rule-13.3: (Advisory) |
|
||||
![]() | |||||||
Amplification:
A function call is considered to be a side effect for the purposes of this rule.
All sub-expressions of the full expression are treated as if they were evaluated for the purposes of this rule, even if specified as not being evaluated by The Standard.
Example Code:
#pragma PRQA_MESSAGES_OFF 2982,2983,2984
#include "misra.h"
#include "m3cmex.h"
struct XS
{
int16_t a;
int16_t b;
};
extern int16_t rule_1303( void )
{
int16_t x = 0;
int16_t r;
int16_t buf[10] = {0};
int16_t *psi;
struct XS xsa = {0};
struct XS *ps;
++x;
x++;
--x;
x--;
r = ++x; /* 3440 */
r = x++; /* 3440 */
r = --x; /* 3440 */
r = x--; /* 3440 */
buf[0]++;
xsa.a++;
ps = &xsa;
ps->a++;
psi = &buf[5];
(*psi)++;
return r;
}
QAC messages that encompass this guideline:
| 3440 | Using the value resulting from a ++ or -- operation. |
|
||
(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 |