On Sat, Jan 26, 2019 at 7:56 AM Marvin Renich <m...@renich.org> wrote: > > * Ian Lance Taylor <i...@golang.org> [190125 18:11]: > > On Fri, Jan 25, 2019 at 2:59 PM <johnmr...@gmail.com> wrote: > > > I still can't find anything "authoritative and unambiguous" on this. > > > Therefore apps are going to be released with bugs in them. Can > > > someone please say specifically when it is _not_ safe to use 64-bit > > > atomic operations? > > > > > > When it is unsafe on a 64-bit OS? > > > When it is unsafe on a 32-bit OS? > > > > Speaking pedantically, it's not the OS that matters, it's the > > processor (in Go terms, the GOARCH value). > > > > The exact rules can be seen at the bottom of > > https://golang.org/pkg/sync/atomic/ , in the "Bugs" section. > > In that section it says "The first word in a variable or in an allocated > struct, array, or slice can be relied upon to be 64-bit aligned." Does > that mean that an embedded struct in an allocated struct may not be > aligned? As in > > type A struct { > a uint64 > } > > type B struct { > b int8 > d A > } > > type C struct { > c int8 > e *A > } > > var x = B{3, A{4}} > var y = C{6, &A{7}} > > x.d.a might not be aligned, but y.e.a will be?
Yes. Ian -- 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.