Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
f4c7db0e
Commit
f4c7db0e
authored
Jun 17, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spec: disallow goto into blocks
R=gri, r, r CC=golang-dev
https://golang.org/cl/4631045
parent
21e75da4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
7 deletions
+26
-7
go_spec.html
doc/go_spec.html
+26
-7
No files found.
doc/go_spec.html
View file @
f4c7db0e
<!-- title The Go Programming Language Specification -->
<!-- title The Go Programming Language Specification -->
<!-- subtitle Version of June 1
3
, 2011 -->
<!-- subtitle Version of June 1
7
, 2011 -->
<!--
<!--
TODO
TODO
...
@@ -4393,8 +4393,8 @@ goto Error
...
@@ -4393,8 +4393,8 @@ goto Error
<p>
<p>
Executing the "goto" statement must not cause any variables to come into
Executing the "goto" statement must not cause any variables to come into
scope that were not already in scope at the point of the goto. For
<a
href=
"#Declarations_and_scope"
>
scope
</a>
that were not already in scope at the point of the goto.
instance, this example:
For
instance, this example:
</p>
</p>
<pre>
<pre>
...
@@ -4406,9 +4406,29 @@ L:
...
@@ -4406,9 +4406,29 @@ L:
<p>
<p>
is erroneous because the jump to label
<code>
L
</code>
skips
is erroneous because the jump to label
<code>
L
</code>
skips
the creation of
<code>
v
</code>
.
the creation of
<code>
v
</code>
.
<!--
</p>
(<span class="alert">TODO: Eliminate in favor of used and not set errors?</span>)
-->
<p>
A "goto" statement outside a
<a
href=
"#Blocks"
>
block
</a>
cannot jump to a label inside that block.
For instance, this example:
</p>
<pre>
if n%2 == 1 {
goto L1
}
for n
>
0 {
f()
n--
L1:
f()
n--
}
</pre>
<p>
is erroneous because the label
<code>
L1
</code>
is inside
the "for" statement's block but the
<code>
goto
</code>
is not.
</p>
</p>
<h3
id=
"Fallthrough_statements"
>
Fallthrough statements
</h3>
<h3
id=
"Fallthrough_statements"
>
Fallthrough statements
</h3>
...
@@ -5244,7 +5264,6 @@ The following minimal alignment properties are guaranteed:
...
@@ -5244,7 +5264,6 @@ The following minimal alignment properties are guaranteed:
<span
class=
"alert"
>
<span
class=
"alert"
>
<h2
id=
"Implementation_differences"
>
Implementation differences - TODO
</h2>
<h2
id=
"Implementation_differences"
>
Implementation differences - TODO
</h2>
<ul>
<ul>
<li>
The restriction on
<code>
goto
</code>
statements and targets (no intervening declarations) is not honored.
</li>
<li><code>
len(a)
</code>
is only a constant if
<code>
a
</code>
is a (qualified) identifier denoting an array or pointer to an array.
</li>
<li><code>
len(a)
</code>
is only a constant if
<code>
a
</code>
is a (qualified) identifier denoting an array or pointer to an array.
</li>
<li><code>
nil
</code>
maps are not treated like empty maps.
</li>
<li><code>
nil
</code>
maps are not treated like empty maps.
</li>
<li>
Trying to send/receive from a
<code>
nil
</code>
channel causes a run-time panic.
</li>
<li>
Trying to send/receive from a
<code>
nil
</code>
channel causes a run-time panic.
</li>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment