Please post code as just text. Also, inverted color schemes are hard to
read for some people.

Wrt string copying, see https://research.swtch.com/godata

to;dr Copying a string copies two machine words.

On Sat, Aug 1, 2020, 16:49 Serge Hulne <serge.hu...@gmail.com> wrote:

> ```
> package main
>
> import (
>     "fmt"
> )
>
> func f(s *string) {
>     a := "Hello"
>     b := "Hello"
>     c := "bye"
>     d := a
>     fmt.Printf("pa: %p\n", &a)
>     fmt.Printf("pb: %b\n", &b)
>     fmt.Printf("pc: %v\n", &c)
>     fmt.Printf("pd: %v\n", &d)
>     fmt.Printf("p(f(u)): %p\n", s)
> }
>
> func main() {
>     u := "test"
>     fmt.Printf("pu: %p\n", &u)
>     f(&u)
> }
> ```
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/e31f6d86-ce19-4c81-8ac9-a62f0c7b3bc7o%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/e31f6d86-ce19-4c81-8ac9-a62f0c7b3bc7o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-W%3DevLOUVSNHAhiEXkG%2BLv35a1RR2HzhdmvHHxk4dnMdA%40mail.gmail.com.

Reply via email to