On Tue, Oct 11, 2016 at 4:26 PM T L <[email protected]> wrote:
package main
import (
"sync/atomic"
"unsafe"
)
type T struct {
a *int // no ways?!
}
func (t T) A() *int {
return
(*int)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&t.a))))
}
func main() {
i := 42
t := &T{&i}
p := t.A()
println(*p)
}
(https://play.golang.org/p/zHaeGjvEUC)
--
-j
--
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.