On Tuesday, October 11, 2016 at 11:13:05 PM UTC+8, Konstantin Khomoutov wrote: > > On Tue, 11 Oct 2016 07:55:21 -0700 (PDT) > T L <tapi...@gmail.com <javascript:>> wrote: > > [...] > > > (*int)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&t.a)))) > > Wow, cool! > > So values of type unsafe.Pointer can be converted to values of type > > *unsafe.Pointer? > > But I can't find the official docs mentioning this. Is it safe?
> When you're using package "unsafe", all bets are already off ;-) > > But OK, I'd say the type unsafe.Pointer represents values which are > integers large enough to store pointer values of the target platform. > Since *unsafe.Pointer is a pointer, I see no problem with > type-converting it to unsafe.Pointer as both values definitely share > the underlying representation. > As I know, about unsafe package, the followings are promised in later go versions: * the signatures of the functions in unsafe package will not change, and the unsafe.Pointer type will always there (confirmed by Ian). * uintptr value can be converted into unsafe.Pointer, and vice versa (confirmed by spec) * pointer of any value can be converted into unsafe.Pointer, and vice versa (confirmed by unsafe package doc, and implied by spec) -- 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.