1
0
mirror of https://github.com/golang/go synced 2024-11-26 03:17:57 -07:00

reflect: document the unreliability of StringHeader and SliceHeader

R=golang-dev, adg, dvyukov
CC=golang-dev
https://golang.org/cl/8494045
This commit is contained in:
Rob Pike 2013-04-07 18:42:47 -07:00
parent 78c4d50d25
commit 092c481c1b

View File

@ -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