Can users of sync/atomic assume that memory will initially be zeroed? Or is it necessary for a manual zeroing (using the atomic store operations) to happen-before any reads?
Context: https://github.com/golang/go/issues/5045 has the suggestion that "you shouldn't mix atomic and non-atomic accesses for a given memory word," and `runtime/HACKING.md` says that zeroing does not always use write barriers: https://github.com/golang/go/blob/1c2d4da10f6edf9a83fb0cffaaf9f631f462d26b/src/runtime/HACKING.md#zero-initialization-versus-zeroing But the sync.Once implementation doesn't seem to worry about this: https://github.com/golang/go/blob/1c2d4da10f6edf9a83fb0cffaaf9f631f462d26b/src/sync/once.go#L41 so I'm interested in whether manual zeroing is required, and also in the reasons why or why not. Thanks for your time. -- 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.