]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cgo: clarify that strings and slices may contain C pointers
authorIan Lance Taylor <iant@golang.org>
Sat, 10 Aug 2024 23:31:28 +0000 (16:31 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 12 Aug 2024 17:50:56 +0000 (17:50 +0000)
Fixes #68832

Change-Id: I74b6aad9a18953c263cbbe795268017a72261f7f
Reviewed-on: https://go-review.googlesource.com/c/go/+/604715
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com>

src/cmd/cgo/doc.go

index 8e11a12740724460fb6378cda57ab8ed6ffe31e6..eb20ebdb0d361cb44a04405aab72763f80f2a42d 100644 (file)
@@ -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