...
Non-Compliant Code Example
The following This code can result in a divide-by-zero error during the division of the signed operands sl1
and sl2
.
Code Block |
---|
signed long sl1, sl2, result; result = sl1 / sl2; |
Compliant Solution
The following This compliant solution tests the suspect division operation to guarantee there is no possibility of divide-by-zero errors or signed overflow.
...
Non-Compliant Code Example
The following This code can result in a divide-by-zero error during the modulo operation on the signed operands sl1
and sl2
.
Code Block |
---|
signed long sl1, sl2, result; result = sl1 % sl2; |
Compliant Solution
The following This compliant solution tests the suspect modulo operation to guarantee there is no possibility of a divide-by-zero error.
...