![]() |
![]() |
0844 | ![]() |
||||
![]() | |||||||
| Constraint violations | REFERENCE - ISO:C90-6.8.3 Macro Replacement - Constraints | ||||||
This is a constraint error A #define directive has attempted to redefine a macro. A #define directive cannot redefine an existing macro unless the definitions are identical (apart from white space differences). It is seldom wise to change the definition of an existing macro, but if it is really necessary, the #undef directive must be used first. For example:
/*PRQA S 553,841,2017,3429,3453,3614 ++*/
#define M1 10
#define M2 10
#define FM1(a,b) ((a) + (b))
#define FM2(a,b) ((a) + (b))
#define M1 20 /* Message 0844 */
#undef M2
#define M2 20 /* OK */
#define FM1(a,b) ((a) + 2 * (b)) /* Message 0844 */
#undef FM2
#define FM2(a,b) ((a) + 2 * (b)) /* OK */
MISRA C:2012 Rules applicable to message 0844:
| Rule-1.1 (Required) | The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation's translation limits |
See also:
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index | Contents |