1
0
mirror of https://github.com/golang/go synced 2024-09-30 22:48:32 -06:00

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:
Robert Griesemer 2014-10-08 13:49:38 -07:00
parent c066f3309e
commit 2f1c768885

View File

@ -28,6 +28,11 @@ type Sizes interface {
// specified size.
// - The size of strings and interfaces is 2*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.
// - Arrays and structs are aligned per spec definition; all other
// types are naturally aligned with a maximum alignment MaxAlign.