[go-nuts] A question about the atomic operations in golang

2017-01-08 Thread
Is the size of a pointer value 32 bits or 64 bits in golang when build with `GOARCH=amd64` option specified and running on 64-bit OS? If it's 64-bit size, is a global pointer value 8-byte aligned in memory so that a read or write operation of that pointer value is carried out atomically? For exa

Re: [go-nuts] A question about the atomic operations in golang

2017-01-09 Thread
Yes, the author of that post is also me : ) 在 2017年1月9日星期一 UTC+8下午6:30:59,Konstantin Khomoutov写道: > > On Sun, 8 Jan 2017 01:22:59 -0800 (PST) > 陈诚 > wrote: > > > Is the size of a pointer value 32 bits or 64 bits in golang when > > build with `GOARCH=amd64` option

[go-nuts] Re: A question about the atomic operations in golang

2017-01-09 Thread
lo will print "hello, world" at some point in the future >> (perhaps after hello has returned). > > > On Sunday, January 8, 2017 at 1:17:56 PM UTC-5, 陈诚 wrote: > >> Is the size of a pointer value 32 bits or 64 bits in golang when build >> with `GOARCH=amd64`

[go-nuts] Re: A question about the atomic operations in golang

2017-01-09 Thread
Thanks for your caution. Then is there a way to know that a certain variable is aligned properly? Will the compiler make the global variable `var p *int` in my sample code aligned properly? 在 2017年1月9日星期一 UTC+8上午3:17:37,Dave Cheney写道: > > What you are talking about is called a torn write, which