From f4c7db0ed96b985942a21e94496717ece0fc940e Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 17 Jun 2011 12:49:04 -0400 Subject: [PATCH] spec: disallow goto into blocks R=gri, r, r CC=golang-dev https://golang.org/cl/4631045 --- doc/go_spec.html | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) 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