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
d1f627f2
Commit
d1f627f2
authored
May 16, 2014
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc/go1.3.html: add note about small map iteration order
LGTM=r R=r CC=golang-codereviews
https://golang.org/cl/98290048
parent
23e8c0d2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
go1.3.html
doc/go1.3.html
+22
-0
No files found.
doc/go1.3.html
View file @
d1f627f2
...
...
@@ -137,6 +137,28 @@ to <code>unsafe.Pointer</code> is illegal and must be rewritten.
Such code can be identified by
<code>
go vet
</code>
.
</p>
<h3
id=
"map"
>
Map iteration
</h3>
<p>
Iterations over small maps no longer happen in a consistent order.
Go 1 defines that
“
<a
href=
"http://golang.org/ref/spec#For_statements"
>
The iteration order over maps
is not specified and is not guaranteed to be the same from one iteration to the next.
</a>
”
To keep code from depending on map iteration order,
Go 1.0 started each map iteration at a random index in the map.
A new map implementation introduced in Go 1.1 neglected to randomize
iteration for maps with eight or fewer entries, although the iteration order
can still vary from system to system.
This has allowed people to write Go 1.1 and Go 1.2 programs that
depend on small map iteration order and therefore only work reliably on certain systems.
Go 1.3 reintroduces random iteration for small maps in order to flush out these bugs.
</p>
<p>
<em>
Updating
</em>
: If code assumes a fixed iteration order for small maps,
it will break and must be rewritten not to make that assumption.
Because only small maps are affected, the problem arises most often in tests.
</p>
<h3
id=
"liblink"
>
The linker
</h3>
<p>
...
...
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