]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: document ptrdata field of rtype
authorSebastien Binet <seb.binet@gmail.com>
Tue, 18 Apr 2017 08:48:16 +0000 (10:48 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 18 Apr 2017 15:30:04 +0000 (15:30 +0000)
This CL adds a simple explanation about what means the ptrdata field of
the reflect.rtype type.
Also document that rtype needs to be kept in sync with the runtime._type
type that rtype mirrors.

Change-Id: Icd9663a2e4bb94d922a2417cfe4537861d2ccc97
Reviewed-on: https://go-review.googlesource.com/40917
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/reflect/type.go

index c182d8c7da89e4836862c90f2b9c57b121aa8d97..13d63489f7022ec5ecc2aaf2a4b2f935c63cd5f2 100644 (file)
@@ -289,9 +289,11 @@ const (
 // It is embedded in other, public struct types, but always
 // with a unique tag like `reflect:"array"` or `reflect:"ptr"`
 // so that code cannot convert from, say, *arrayType to *ptrType.
+//
+// rtype must be kept in sync with ../runtime/type.go:/^type._type.
 type rtype struct {
        size       uintptr
-       ptrdata    uintptr
+       ptrdata    uintptr  // number of bytes in the type that can contain pointers
        hash       uint32   // hash of type; avoids computation in hash tables
        tflag      tflag    // extra type information flags
        align      uint8    // alignment of variable with this type