]> Cypherpunks.ru repositories - gostls13.git/commitdiff
unsafe: fix doc strings
authorRobert Griesemer <gri@golang.org>
Tue, 27 Jan 2015 17:57:48 +0000 (09:57 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 27 Jan 2015 18:52:21 +0000 (18:52 +0000)
Change-Id: I73a416291a2374dbb8ce8586f24059f8dce56529
Reviewed-on: https://go-review.googlesource.com/3360
Reviewed-by: Alan Donovan <adonovan@google.com>
src/unsafe/unsafe.go

index 79499b2955f633b50d6da71c1cc658168a71d5fd..f492e9758b9ce34aa4314a4c73812857ac792c92 100644 (file)
@@ -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