From: Russ Cox
Date: Fri, 17 Jun 2011 16:49:04 +0000 (-0400)
Subject: spec: disallow goto into blocks
X-Git-Tag: weekly.2011-06-23~72
X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=f4c7db0ed96b985942a21e94496717ece0fc940e;p=gostls13.git
spec: disallow goto into blocks
R=gri, r, r
CC=golang-dev
https://golang.org/cl/4631045
---
diff --git a/doc/go_spec.html b/doc/go_spec.html
index f82336a85b..489ad4db36 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,5 +1,5 @@
-
+
+
+
+
+A "goto" statement outside a block cannot jump to a label inside that block.
+For instance, this example:
+
+
+
+if n%2 == 1 {
+ goto L1
+}
+for n > 0 {
+ f()
+ n--
+L1:
+ f()
+ n--
+}
+
+
+
+is erroneous because the label L1
is inside
+the "for" statement's block but the goto
is not.
Fallthrough statements
@@ -5244,7 +5264,6 @@ The following minimal alignment properties are guaranteed:
Implementation differences - TODO
- - The restriction on
goto
statements and targets (no intervening declarations) is not honored.
len(a)
is only a constant if a
is a (qualified) identifier denoting an array or pointer to an array.
nil
maps are not treated like empty maps.
- Trying to send/receive from a
nil
channel causes a run-time panic.