Hello,
I was expecting it to segfault after deallocating CString. How does it work
internally?
func (m *Message) Test() string {
s := C.CString("test")
C.free(unsafe.Pointer(s))
sh := reflect.StringHeader{(uintptr)(unsafe.Pointer(s)), 4}
return *(*string)(unsafe.Pointer(&sh))
}
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.