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

unsafe: fix the documentation

Reflection is about Pointer, not uintptr.
Also clarify that Reflect and Unreflect are indirect.

R=rsc
CC=golang-dev
https://golang.org/cl/4254052
This commit is contained in:
Rob Pike 2011-03-02 19:39:08 -08:00
parent daffc2d2ef
commit 68add46af7

View File

@ -41,13 +41,14 @@ func Typeof(i interface{}) (typ interface{})
// Reflect unpacks an interface value into its type and the address of a copy of the
// internal value.
func Reflect(i interface{}) (typ interface{}, addr uintptr)
func Reflect(i interface{}) (typ interface{}, addr Pointer)
// Unreflect inverts Reflect: Given a type and a pointer, it returns an empty interface value
// with those contents. The typ is assumed to contain a pointer to a runtime type;
// the type information in the interface{} is ignored, so that, for example, both
// Unreflect inverts Reflect: Given a type and a pointer to a value, it returns an
// empty interface value with contents the type and the value (not the pointer to
// the value). The typ is assumed to contain a pointer to a runtime type; the type
// information in the interface{} is ignored, so that, for example, both
// *reflect.StructType and *runtime.StructType can be passed for typ.
func Unreflect(typ interface{}, addr uintptr) (ret interface{})
func Unreflect(typ interface{}, addr Pointer) (ret interface{})
// New allocates and returns a pointer to memory for a new value of the given type.
// The typ is assumed to hold a pointer to a runtime type.