Closed
Description
People are confused about when it is safe to convert an unsafe.Pointer to a uintptr. If the unsafe.Pointer is the only pointer to the object, when is the GC permitted to collect it? We need to write down some rules for constructs that are always safe. It seems to me that we must permit unsafe.Pointer(uintptr(p) + offset) It also seems to me that we must permit passing unsafe.Pointer values converted to uintptr to syscall.Syscall. syscall.Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(n)))) If these sorts of constructs will not work safely, then we should consider disallowing them. And in general we must write down what is permitted.