From: Ian Lance Taylor Date: Sat, 10 Aug 2024 23:31:28 +0000 (-0700) Subject: cmd/cgo: clarify that strings and slices may contain C pointers X-Git-Tag: go1.24rc1~1219 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=82dcd147b684c6e61d42f41ce940946dd2916106;p=gostls13.git cmd/cgo: clarify that strings and slices may contain C pointers Fixes #68832 Change-Id: I74b6aad9a18953c263cbbe795268017a72261f7f Reviewed-on: https://go-review.googlesource.com/c/go/+/604715 Reviewed-by: Cherry Mui LUCI-TryBot-Result: Go LUCI Auto-Submit: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Reviewed-by: Carlos Amedee Commit-Queue: Ian Lance Taylor --- diff --git a/src/cmd/cgo/doc.go b/src/cmd/cgo/doc.go index 8e11a12740..eb20ebdb0d 100644 --- a/src/cmd/cgo/doc.go +++ b/src/cmd/cgo/doc.go @@ -347,12 +347,12 @@ determined by how the memory was allocated; it has nothing to do with the type of the pointer. Note that values of some Go types, other than the type's zero value, -always include Go pointers. This is true of string, slice, interface, -channel, map, and function types. A pointer type may hold a Go pointer -or a C pointer. Array and struct types may or may not include Go -pointers, depending on the element types. All the discussion below -about Go pointers applies not just to pointer types, but also to other -types that include Go pointers. +always include Go pointers. This is true of interface, channel, map, +and function types. A pointer type may hold a Go pointer or a C pointer. +Array, slice, string, and struct types may or may not include Go pointers, +depending on their type and how they are constructed. All the discussion +below about Go pointers applies not just to pointer types, +but also to other types that include Go pointers. All Go pointers passed to C must point to pinned Go memory. Go pointers passed as function arguments to C functions have the memory they point to