Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
f05a91e1
Commit
f05a91e1
authored
Aug 09, 2012
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spec: clarify evaluation order
Fixes #3852. R=r, rsc, iant, ken CC=golang-dev
https://golang.org/cl/6441102
parent
20bf1a94
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
doc/go_spec.html
doc/go_spec.html
+11
-3
No files found.
doc/go_spec.html
View file @
f05a91e1
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Version of
July 11
, 2012",
"Subtitle": "Version of
August 9
, 2012",
"Path": "/ref/spec"
}-->
...
...
@@ -3694,8 +3694,10 @@ overflow etc. errors being caught.
<h3
id=
"Order_of_evaluation"
>
Order of evaluation
</h3>
<p>
When evaluating the elements of an assignment or expression,
all function calls, method calls and
When evaluating the
<a
href=
"#Operands"
>
operands
</a>
of an expression,
<a
href=
"#Assignments"
>
assignment
</a>
, or
<a
href=
"#Return_statements"
>
return statement
</a>
,
all function calls, method calls, and
communication operations are evaluated in lexical left-to-right
order.
</p>
...
...
@@ -3715,6 +3717,12 @@ and indexing of <code>x</code> and the evaluation
of
<code>
y
</code>
is not specified.
</p>
<pre>
a := 1
f := func() int { a = 2; return 3 }
x := []int{a, f()} // x may be [1, 3] or [2, 3]: evaluation order between a and f() is not specified
</pre>
<p>
Floating-point operations within a single expression are evaluated according to
the associativity of the operators. Explicit parentheses affect the evaluation
...
...
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