From: Cuong Manh Le Date: Sat, 24 Jul 2021 11:34:16 +0000 (+0700) Subject: doc: clarify non-nil zero length slice to array pointer conversion X-Git-Tag: go1.17rc2~1^2~12 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ecaa6816bfdbcef2ad749958a11a321de5c2ebd8;p=gostls13.git 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 Trust: Robert Griesemer Run-TryBot: Cuong Manh Le TryBot-Result: Go Bot Reviewed-by: Robert Griesemer --- diff --git a/doc/go_spec.html b/doc/go_spec.html index cc7ed6a561..0e14a1f3b6 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -4335,6 +4335,9 @@ s4 := (*[4]byte)(s) // panics: len([4]byte) > len(s) var t []string t0 := (*[0]string)(t) // t0 == nil t1 := (*[1]string)(t) // panics: len([1]string) > len(t) + +u := make([]byte, 0) +u0 = (*[0]byte)(u) // u0 != nil

Constant expressions