![]() |
|
MISRA C:2012 Rule-12.2: (Required) |
|
||||
![]() | |||||||
Example Code:
#pragma PRQA_MESSAGES_OFF 2982,2984
#include "misra.h"
#include "m3cmex.h"
#define SHIFT16 16u
#define SHIFT15 15u
#define SHIFT8 8u
#define SHIFT7 7u
#define SHIFT1 1u
#define SHIFTM1 (-1)
extern int16_t rule_1202( void )
{
u16r = u16a >> SHIFT1; /* */
u16r = u16a >> SHIFT15; /* */
u16r = u16a >> SHIFT16; /* 2790 */
u16r = u16a >> SHIFTM1; /* 2790 4534 */
u8r = u8a >> SHIFT8; /* 0499 */
u8r = u8a >> SHIFT7; /* */
return 1;
}
QAC messages that encompass this guideline:
| 0499 | Right operand of shift operator is greater than or equal to the width of the essential type of the left operand. |
| 2790 | Constant: Right hand operand of shift operator is negative or too large. |
|
||
(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 |