From: Rob Pike Date: Mon, 8 Apr 2013 01:42:47 +0000 (-0700) Subject: reflect: document the unreliability of StringHeader and SliceHeader X-Git-Tag: go1.1rc2~146 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=092c481c1bc1982ca992512d0e75503ca5878800;p=gostls13.git reflect: document the unreliability of StringHeader and SliceHeader R=golang-dev, adg, dvyukov CC=golang-dev https://golang.org/cl/8494045 --- diff --git a/src/pkg/reflect/value.go b/src/pkg/reflect/value.go index 5a37204895..80aa85723c 100644 --- a/src/pkg/reflect/value.go +++ b/src/pkg/reflect/value.go @@ -1699,14 +1699,22 @@ func (v Value) UnsafeAddr() uintptr { } // StringHeader is the runtime representation of a string. -// It cannot be used safely or portably. +// It cannot be used safely or portably and its representation may +// change in a later release. +// Moreover, the Data field is not sufficient to guarantee the data +// it references will not be garbage collected, so programs must keep +// a separate, correctly typed pointer to the underlying data. type StringHeader struct { Data uintptr Len int } // SliceHeader is the runtime representation of a slice. -// It cannot be used safely or portably. +// It cannot be used safely or portably and its representation may +// change in a later release. +// Moreover, the Data field is not sufficient to guarantee the data +// it references will not be garbage collected, so programs must keep +// a separate, correctly typed pointer to the underlying data. type SliceHeader struct { Data uintptr Len int