diff options
author | Robert Griesemer <gri@golang.org> | 2015-01-27 09:57:48 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2015-01-27 18:52:21 +0000 |
commit | 3a52338608f9e34843007441bdceceedd888a640 (patch) | |
tree | a6068dbfccc2cd2afb8bf58ec87895c7d904f2c5 /src/unsafe | |
parent | 205ae07cd3c39dbb17948e3c957a785212a8c5d1 (diff) | |
download | go-3a52338608f9e34843007441bdceceedd888a640.tar.gz go-3a52338608f9e34843007441bdceceedd888a640.zip |
unsafe: fix doc strings
Change-Id: I73a416291a2374dbb8ce8586f24059f8dce56529
Reviewed-on: https://go-review.googlesource.com/3360
Reviewed-by: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'src/unsafe')
-rw-r--r-- | src/unsafe/unsafe.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/unsafe/unsafe.go b/src/unsafe/unsafe.go index 79499b2955..f492e9758b 100644 --- a/src/unsafe/unsafe.go +++ b/src/unsafe/unsafe.go @@ -24,17 +24,19 @@ type ArbitraryType int // arbitrary memory. It should be used with extreme care. type Pointer *ArbitraryType -// Sizeof returns the size in bytes occupied by the value v. The size is that of the -// "top level" of the value only. For instance, if v is a slice, it returns the size of -// the slice descriptor, not the size of the memory referenced by the slice. -func Sizeof(v ArbitraryType) uintptr +// Sizeof takes an expression x of any type and returns the size of +// a hypothetical variable v as if v was declared via var v = x. +// Note that the size does not include any memory possibly referenced +// by x. For instance, if x is a slice, Sizeof returns the size of the +// slice descriptor, not the size of the memory referenced by the slice. +func Sizeof(x ArbitraryType) uintptr -// Offsetof returns the offset within the struct of the field represented by v, +// Offsetof returns the offset within the struct of the field represented by x, // which must be of the form structValue.field. In other words, it returns the // number of bytes between the start of the struct and the start of the field. -func Offsetof(v ArbitraryType) uintptr +func Offsetof(x ArbitraryType) uintptr -// Alignof returns the alignment of the value v. It is the maximum value m such -// that the address of a variable with the type of v will always be zero mod m. -// If v is of the form structValue.field, it returns the alignment of field f within struct object obj. -func Alignof(v ArbitraryType) uintptr +// Alignof takes an expression x of any type and returns the alignment +// of a hypothetical variable v as if v was declared via var v = x. +// It is the largest value m such that the address of v is zero mod m. +func Alignof(x ArbitraryType) uintptr |