Thanks, all!!!
Frank
On Friday, January 5, 2018 at 4:25:33 AM UTC-5, Ian Davis wrote:
>
> On Thu, 4 Jan 2018, at 6:55 PM, Frank Davidson wrote:
>
> Thanks!!! Very helpful blog post!!
>
> So, in proc, the slice header is copied, then an entirely new array is
> created - []byte{5,6,7,8} - and the
On Thu, 4 Jan 2018, at 6:55 PM, Frank Davidson wrote:
> Thanks!!! Very helpful blog post!!
>
> So, in proc, the slice header is copied, then an entirely new array is
> created - []byte{5,6,7,8} - and the slice header copy is set to point
> at that new array, and then discarded, whereas in proc 2,
Thanks!!! Very helpful blog post!!
So, in proc, the slice header is copied, then an entirely new array is
created - []byte{5,6,7,8} - and the slice header copy is set to point at
that new array, and then discarded, whereas in proc 2, the slice header is
not reset, and so still points to the ori
On Thu, Jan 4, 2018 at 7:08 PM Frank Davidson wrote:
> I'm sure this has probably been answered before, but I have a question
about when a slice's underlying array is copied? In this code:
In your code the underlying arrays are never copied when passed around.
--
-j
--
You received this m
On Thu, Jan 4, 2018 at 10:08 AM, Frank Davidson wrote:
>
> I'm sure this has probably been answered before, but I have a question about
> when a slice's underlying array is copied? In this code:
>
> https://play.golang.org/p/TnMFo-rYKzq
>
> package main
>
> import (
> "fmt"
> )
>
> func main() {
>
I'm sure this has probably been answered before, but I have a question
about when a slice's underlying array is copied? In this code:
https://play.golang.org/p/TnMFo-rYKzq
package main
import (
"fmt"
)
func main() {
out := []byte{1, 2, 3, 4}
fmt.Println(out)
proc(out)
fmt.Println(out)
proc2(o