[previous] 2830 [next] Constant: Division by zero.
Overflow and wraparound

A division (/) or remainder (%) operation has been encountered in which the second operand is a constant expression of value zero. The result will be undefined.

For example:


/*PRQA S 586,2017,2983,2986,3103,3199,3203,3227,3408 ++*/

#define RED  45
#define GRN  45

extern void foo(int n)
{
   int r;

   r = n / (RED - GRN);                     /* 2830 */
}


MISRA C:2012 Rules applicable to message 2830:

Rule-1.3  (Required) There shall be no occurrence of undefined or critical unspecified behaviour


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