Skip to content

Commit 11ec59a

Browse files
unsafe: document that Sizeof includes field alignment
Fixes #52018 Change-Id: I6d06d5b5279b9bdc899b0ad43488577d3c0b94be Reviewed-on: https://go-review.googlesource.com/c/go/+/397516 Trust: Ian Lance Taylor <[email protected]> Reviewed-by: Emmanuel Odeke <[email protected]> Reviewed-by: Rob Pike <[email protected]>
1 parent 7fbabe8 commit 11ec59a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/unsafe/unsafe.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ type Pointer *ArbitraryType
187187
// The size does not include any memory possibly referenced by x.
188188
// For instance, if x is a slice, Sizeof returns the size of the slice
189189
// descriptor, not the size of the memory referenced by the slice.
190+
// For a struct, the size includes any padding introduced by field alignment.
190191
// The return value of Sizeof is a Go constant.
191192
func Sizeof(x ArbitraryType) uintptr
192193

0 commit comments

Comments
 (0)