The string struct used internally is

type stringStruct struct {
    str unsafe.Pointer
    len int
}

When following f function is called and s is cleared, 
how do go runtime knows the starting memory address of the old s.str is "a" 
instead of "c"?

var s = "abcdefg"[2:5] // s.str should point at "c".

func f() {
    s = ""
}


-- 
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