Annex F (informative)
Core undefined behavior
[ub]
F.3
[expr]
: Expressions
[ub.expr]
F.3.29
[ub:expr.mul.representable.type.result]
Specified in:
[expr.
mul]
1
#
If the quotient
a
/
b
is representable in the type of the result,
(
a
/
b
)
*
b
+
a
%
b
is equal to
a
; otherwise, the behavior of both
a
/
b
and
a
%
b
is undefined
.
2
#
[
Example
1
:
#include
<
limits
>
int
main
(
)
{
int
x
=
std
::
numeric_limits
<
int
>
::
min
(
)
/
-
1
;
// Assuming
LP64
−
2
,
147
,
483
,
648
which when divided by
−
1
// gives us
2,147,483,648
which is not representable by
int
.
}
—
end example
]