]> Cypherpunks repositories - gostls13.git/commitdiff
unsafe: add available godoc link
authorcui fliter <imcusg@gmail.com>
Sun, 5 Nov 2023 10:48:27 +0000 (18:48 +0800)
committerGopher Robot <gobot@golang.org>
Thu, 21 Mar 2024 21:01:56 +0000 (21:01 +0000)
Change-Id: I1391ec36063dc609a61cc3b37827a56c7cf97c03
Reviewed-on: https://go-review.googlesource.com/c/go/+/539839
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

src/unsafe/unsafe.go

index 2f4212a1ae7d477785f3118904bc1530c1987ffc..884ef6a85590d6f607bca0eed17ec144ff712c62 100644 (file)
@@ -110,7 +110,7 @@ type IntegerType int
 //     u := unsafe.Pointer(nil)
 //     p := unsafe.Pointer(uintptr(u) + offset)
 //
-// (4) Conversion of a Pointer to a uintptr when calling syscall.Syscall.
+// (4) Conversion of a Pointer to a uintptr when calling [syscall.Syscall].
 //
 // The Syscall functions in package syscall pass their uintptr arguments directly
 // to the operating system, which then may, depending on the details of the call,
@@ -137,7 +137,7 @@ type IntegerType int
 //     u := uintptr(unsafe.Pointer(p))
 //     syscall.Syscall(SYS_READ, uintptr(fd), u, uintptr(n))
 //
-// (5) Conversion of the result of reflect.Value.Pointer or reflect.Value.UnsafeAddr
+// (5) Conversion of the result of [reflect.Value.Pointer] or [reflect.Value.UnsafeAddr]
 // from uintptr to Pointer.
 //
 // Package reflect's Value methods named Pointer and UnsafeAddr return type uintptr
@@ -155,7 +155,7 @@ type IntegerType int
 //     u := reflect.ValueOf(new(int)).Pointer()
 //     p := (*int)(unsafe.Pointer(u))
 //
-// (6) Conversion of a reflect.SliceHeader or reflect.StringHeader Data field to or from Pointer.
+// (6) Conversion of a [reflect.SliceHeader] or [reflect.StringHeader] Data field to or from Pointer.
 //
 // As in the previous case, the reflect data structures SliceHeader and StringHeader
 // declare the field Data as a uintptr to keep callers from changing the result to
@@ -171,7 +171,7 @@ type IntegerType int
 // In this usage hdr.Data is really an alternate way to refer to the underlying
 // pointer in the string header, not a uintptr variable itself.
 //
-// In general, reflect.SliceHeader and reflect.StringHeader should be used
+// In general, [reflect.SliceHeader] and [reflect.StringHeader] should be used
 // only as *reflect.SliceHeader and *reflect.StringHeader pointing at actual
 // slices or strings, never as plain structs.
 // A program should not declare or allocate variables of these struct types.
@@ -206,18 +206,18 @@ func Offsetof(x ArbitraryType) uintptr
 // Alignof takes an expression x of any type and returns the required alignment
 // of a hypothetical variable v as if v was declared via var v = x.
 // It is the largest value m such that the address of v is always zero mod m.
-// It is the same as the value returned by reflect.TypeOf(x).Align().
+// It is the same as the value returned by [reflect.TypeOf](x).Align().
 // As a special case, if a variable s is of struct type and f is a field
 // within that struct, then Alignof(s.f) will return the required alignment
 // of a field of that type within a struct. This case is the same as the
-// value returned by reflect.TypeOf(s.f).FieldAlign().
+// value returned by [reflect.TypeOf](s.f).FieldAlign().
 // The return value of Alignof is a Go constant if the type of the argument
 // does not have variable size.
 // (See the description of [Sizeof] for a definition of variable sized types.)
 func Alignof(x ArbitraryType) uintptr
 
 // The function Add adds len to ptr and returns the updated pointer
-// Pointer(uintptr(ptr) + uintptr(len)).
+// [Pointer](uintptr(ptr) + uintptr(len)).
 // The len argument must be of integer type or an untyped constant.
 // A constant len argument must be representable by a value of type int;
 // if it is an untyped constant it is given type int.