From ddddd39fc8b7ab073044e0fe8ad7c0eb912758b9 Mon Sep 17 00:00:00 2001
From: Robert Griesemer
-If the divisor is zero, a run-time panic occurs.
+If the divisor is a constant, it must not be zero.
+If the divisor is zero at run time, a run-time panic occurs.
If the dividend is positive and the divisor is a constant power of 2,
the division may be replaced by a right shift, and computing the remainder may
be replaced by a bitwise AND operation:
@@ -3692,6 +3693,14 @@ const Huge = 1 << 100
const Four int8 = Huge >> 98
+
+The divisor of a constant division or remainder operation must not be zero:
+
The values of typed constants must always be accurately representable as values
of the constant type. The following constant expressions are illegal:
@@ -4759,8 +4768,6 @@ the function completes.
(See also the section on handling panics.)
+3.14 / 0.0 // illegal: division by zero
+
+
lock(l) defer unlock(l) // unlocking happens before surrounding function returns -- 2.48.1