]> Cypherpunks repositories - gostls13.git/commitdiff
unsafe: remove incorrect type conversion in docs
authorIan Lance Taylor <iant@golang.org>
Sun, 6 Nov 2016 18:35:58 +0000 (10:35 -0800)
committerIan Lance Taylor <iant@golang.org>
Mon, 7 Nov 2016 18:54:14 +0000 (18:54 +0000)
Fixes #17818.

Change-Id: Id7242b0bdd5e1db254b44ae29900fc4f3362c743
Reviewed-on: https://go-review.googlesource.com/32828
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/unsafe/unsafe.go

index 0b59ff204b08d62f892dac9bdb98dcea1f883516..859ca4fa3b7c44a0973823f87bab516a260e5f4d 100644 (file)
@@ -155,7 +155,7 @@ type ArbitraryType int
 //     var s string
 //     hdr := (*reflect.StringHeader)(unsafe.Pointer(&s)) // case 1
 //     hdr.Data = uintptr(unsafe.Pointer(p))              // case 6 (this case)
-//     hdr.Len = uintptr(n)
+//     hdr.Len = n
 //
 // In this usage hdr.Data is really an alternate way to refer to the underlying
 // pointer in the slice header, not a uintptr variable itself.
@@ -168,7 +168,7 @@ type ArbitraryType int
 //     // INVALID: a directly-declared header will not hold Data as a reference.
 //     var hdr reflect.StringHeader
 //     hdr.Data = uintptr(unsafe.Pointer(p))
-//     hdr.Len = uintptr(n)
+//     hdr.Len = n
 //     s := *(*string)(unsafe.Pointer(&hdr)) // p possibly already lost
 //
 type Pointer *ArbitraryType