The Standard does not provide portable semantics for the division
and remainder operators. DEC C follows these semantics:
- If either operand of the division operator (/) is
negative, the result is truncated toward zero (the largest
integer of lesser magnitude than the algebraic quotient)
- If either operand of the remainder operator (%) is
negative, the sign of the result is the same as the sign of the
first operand (for common C, MIPS C, and VAX C compatibility)
The compiler issues a warning in the following cases of undefined
behavior detected at compile time:
- Integer overflow
- Division by zero
- Remainder by zero
Previous Page | Next Page | Table of Contents | Index