summaryrefslogtreecommitdiff
path: root/doc/go1.3.html
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-05-15 16:16:26 -0400
committerRuss Cox <rsc@golang.org>2014-05-15 16:16:26 -0400
commit313cd9d49910875f26360b846b32b3db7d21fcd0 (patch)
tree658d978ade18ceac21d7a6b7cae9eb99cddbd093 /doc/go1.3.html
parent5f833440a22b83aecefc95f3d8493b06d447852d (diff)
downloadgo-313cd9d49910875f26360b846b32b3db7d21fcd0.tar.gz
doc/go1.3.html: add note about unsafe.Pointer strictness
The vet check is in CL 10470044. LGTM=bradfitz, r R=r, bradfitz CC=golang-codereviews https://codereview.appspot.com/91480044
Diffstat (limited to 'doc/go1.3.html')
-rw-r--r--doc/go1.3.html20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/go1.3.html b/doc/go1.3.html
index e13faa1b0..056c4cbe8 100644
--- a/doc/go1.3.html
+++ b/doc/go1.3.html
@@ -117,6 +117,26 @@ This means that a non-pointer Go value such as an integer will never be mistaken
pointer and prevent unused memory from being reclaimed.
</p>
+<p>
+Starting with Go 1.3, the runtime assumes that values with pointer type
+contain pointers and other values do not.
+This assumption is fundamental to the precise behavior of both stack expansion
+and garbage collection.
+Programs that use <a href="/pkg/unsafe/">package unsafe</a>
+to store <code>uintptrs</code> in pointer values are illegal and will crash if the runtime detects the behavior.
+Programs that use <a href="/pkg/unsafe/">package unsafe</a> to store pointers
+in <code>uintptr</code> values are also illegal but more difficult to diagnose during execution.
+Because the pointers are hidden from the runtime, a stack expansion or garbage collection
+may reclaim the memory they point at, creating
+<a href="http://en.wikipedia.org/wiki/Dangling_pointer">dangling pointers</a>.
+</p>
+
+<p>
+<em>Updating</em>: Code that converts a <code>uintptr</code> value stored in memory
+to <code>unsafe.Pointer</code> is illegal and must be rewritten.
+Such code can be identified by <code>go vet</code>.
+</p>
+
<h3 id="liblink">The linker</h3>
<p>