go/types: document default unsafe.Sizeof computation better
LGTM=adonovan R=adonovan CC=golang-codereviews https://golang.org/cl/155150043
This commit is contained in:
parent
c066f3309e
commit
2f1c768885
|
|
@ -28,6 +28,11 @@ type Sizes interface {
|
||||||
// specified size.
|
// specified size.
|
||||||
// - The size of strings and interfaces is 2*WordSize.
|
// - The size of strings and interfaces is 2*WordSize.
|
||||||
// - The size of slices is 3*WordSize.
|
// - The size of slices is 3*WordSize.
|
||||||
|
// - The size of arrays is the aligned size (see below) of an element
|
||||||
|
// multiplied by the number of elements.
|
||||||
|
// - The size of a struct is the offset of the last field plus that
|
||||||
|
// field's size. If the struct is used in an array its size must
|
||||||
|
// first be aligned to a multiple of the struct's alignment.
|
||||||
// - All other types have size WordSize.
|
// - All other types have size WordSize.
|
||||||
// - Arrays and structs are aligned per spec definition; all other
|
// - Arrays and structs are aligned per spec definition; all other
|
||||||
// types are naturally aligned with a maximum alignment MaxAlign.
|
// types are naturally aligned with a maximum alignment MaxAlign.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue