On Tue, Jun 1, 2021 at 4:40 PM [email protected] <[email protected]> wrote:
> The following is a tip to get an array pointer but avoid the array escaping.
I don't think so. The pointer to the local array 't', stored in 'y'
never leaves the function, so there's no need for 't' to escape. See
the previous post.
>
> package main
>
> const N = 1<<13
> var i = N-1
>
> func main() {
> var x = &[N]int{} // escapes to heap
> println(x[i])
> var t [N]int // not escape
> var y = &t
> println(y[i])
> }
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/CAA40n-VxPh8R7ALpLdCQUS6PCR2UtVCAZkgFLy_iXVBOcAxR4Q%40mail.gmail.com.