That's not necessary.

https://play.golang.org/p/_iHnithuxz

What a[:] does is create a slice header with the address pointing to
the zeroth element of a.

The code that is generated is exactly the same for both (you can check
this with go tool compile -S).

On Thu, 2016-11-10 at 23:46 -0800, steve tang wrote:
> Thanks,  But I want them hold same data addrs.  So I just changed
> your code 
> to follows:
> a := [3]int{1, 2, 3}
> b := (&a)[:]


-- 
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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to