From: Robert Griesemer Date: Wed, 28 May 2014 15:43:47 +0000 (-0700) Subject: spec: clarify that break/continue do not work across function boundaries X-Git-Tag: go1.3rc1~31 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=94849d5a78009dcaafbde2847cc0a27f53aa3723;p=gostls13.git spec: clarify that break/continue do not work across function boundaries Also made it extra clear for goto statements (even though label scopes are already limited to the function defining a label). Fixes #8040. LGTM=r, rsc R=r, rsc, iant, ken CC=golang-codereviews https://golang.org/cl/99550043 --- diff --git a/doc/go_spec.html b/doc/go_spec.html index 11f6a90e63..baa0ecf40b 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -5093,7 +5093,8 @@ func f(n int) (res int, err error) { A "break" statement terminates execution of the innermost "for", "switch", or -"select" statement. +"select" statement +within the same function.

@@ -5127,6 +5128,7 @@ OuterLoop:
 

A "continue" statement begins the next iteration of the innermost "for" loop at its post statement. +The "for" loop must be within the same function.

@@ -5154,7 +5156,8 @@ RowLoop:
 

Goto statements

-A "goto" statement transfers control to the statement with the corresponding label. +A "goto" statement transfers control to the statement with the corresponding label +within the same function.