Skip to content

Commit ecaa681

Browse files
committed
doc: clarify non-nil zero length slice to array pointer conversion
There is an example for nil slice already, so adding example for non-nil zero length slice, too, clarifying to the reader that the result is also non-nil and different from nil slice case. Updates #395 Change-Id: I019db1b1a1c0c621161ecaaacab5a4d888764b1a Reviewed-on: https://go-review.googlesource.com/c/go/+/336890 Trust: Cuong Manh Le <[email protected]> Trust: Robert Griesemer <[email protected]> Run-TryBot: Cuong Manh Le <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Robert Griesemer <[email protected]>
1 parent 1868f82 commit ecaa681

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

doc/go_spec.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--{
22
"Title": "The Go Programming Language Specification",
3-
"Subtitle": "Version of Jul 24, 2021",
3+
"Subtitle": "Version of Jul 26, 2021",
44
"Path": "/ref/spec"
55
}-->
66

@@ -4335,6 +4335,9 @@ <h4 id="Conversions_from_slice_to_array_pointer">Conversions from slice to array
43354335
var t []string
43364336
t0 := (*[0]string)(t) // t0 == nil
43374337
t1 := (*[1]string)(t) // panics: len([1]string) > len(t)
4338+
4339+
u := make([]byte, 0)
4340+
u0 = (*[0]byte)(u) // u0 != nil
43384341
</pre>
43394342

43404343
<h3 id="Constant_expressions">Constant expressions</h3>

0 commit comments

Comments
 (0)