Re: [go-nuts] Is there any overhead to casting a pointer (or uintptr) to and from unsafe.Pointer? Can uintptr be safely used to reference an object?

2016-06-20 Thread Jason E. Aten
On Mon, Jun 20, 2016 at 1:08 PM, Ian Lance Taylor wrote: > On Mon, Jun 20, 2016 at 10:39 AM, Jason E. Aten > wrote: > > This does raise an interesting question: how should one detect cycles in > a > > graph of Go objects, in a garbage-collection safe manner?

Re: [go-nuts] Is there any overhead to casting a pointer (or uintptr) to and from unsafe.Pointer? Can uintptr be safely used to reference an object?

2016-06-20 Thread andrew . mezoni
>> Keeping a a pointer in a uintptr as a "reference" to something is safe iff it will never be casted back to a pointer. I think this means that the safe case is useless. Storing any reference (read: address) of Go instance is unsafe because after when this operation ends then a stored address

Re: [go-nuts] Is there any overhead to casting a pointer (or uintptr) to and from unsafe.Pointer? Can uintptr be safely used to reference an object?

2016-06-20 Thread Kyle Stanly
Thank you for re-opening and answering the question. The original reason why I closed it was because after looking it up in the unsafe package documentation (as I was skimming through source-code originally) it states in Section 2, Paragraph 4 (I feel