[go-nuts] Slice capacity changes

2017-08-08 Thread sno
Hello, I was wondering if someone could help me understand what is going on in the following piece of code. package main import ( "fmt" "reflect" "unsafe" ) func main() { a := []byte("1234567") printSliceDetails(a) } func printSliceDetails(a []byte) { sliceHeader := (*reflect.SliceHeader)(uns

[go-nuts] Re: Slice capacity changes

2017-08-08 Thread sno
Example at: https://play.golang.org/p/d7HBrbZGo4 -- 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

Re: [go-nuts] Slice capacity changes

2017-08-08 Thread sno
Hmm, interesting. However, wouldn't that mean that if I removed the function and did the following: https://play.golang.org/p/enI6UmYoFJ the escape analysis wouldn't happen? On Wednesday, August 9, 2017 at 1:23:15 PM UTC+12, Marvin Renich wrote: > > * sno > [170808 20:57]

Re: [go-nuts] Slice capacity changes

2017-08-09 Thread sno
Thanks for the explanation. On Wednesday, August 9, 2017 at 11:50:57 PM UTC+12, Marvin Renich wrote: > > [I'm subscribed; reply-to set.] > > * sno > [170808 21:34]: > > Hmm, interesting. However, wouldn't that mean that if I removed the > >