From 18d527b3f09521a21e4068917f9b4513fcfcc2ef Mon Sep 17 00:00:00 2001
From: Robert Griesemer
-As an exception to this rule, if the dividend x / y
truncated towards zero
x
is the most
-negative value for the int type of x
, the quotient
-q = x / -1
is equal to x
(and r = 0
).
+The one exception to this rule is that if the dividend x
is
+the most negative value for the int type of x
, the quotient
+q = x / -1
is equal to x
(and r = 0
)
+due to two's-complement integer overflow:
@@ -3623,11 +3624,11 @@ discard high bits upon overflow, and programs may rely on "wrap around".
For signed integers, the operations +
,
--
, *
, and <<
may legally
+-
, *
, /
, and <<
may legally
overflow and the resulting value exists and is deterministically defined
by the signed integer representation, the operation, and its operands.
-No exception is raised as a result of overflow. A
-compiler may not optimize code under the assumption that overflow does
+No exception is raised as a result of overflow.
+A compiler may not optimize code under the assumption that overflow does
not occur. For instance, it may not assume that x < x + 1
is always true.