▲ | ralfj 4 days ago | |
Can you point me to the Go definition of memory safety? I searched all over their website, and couldn't find any. (But also, it'd be kind of silly for every language to make up their own definition of memory safety. Then even C is memory safe, they just have to define it the right way. ;) | ||
▲ | kiitos 2 days ago | parent | next [-] | |
For the purposes of this discussion, sure: https://go.dev/ref/mem Relevant bit for the OP is probably:
Which describes exactly what is happening in the OP's program:
By itself this isn't a problem, these are just reads, and you don't need synchronization for concurrent reads by themself. The problem is introduced here:
Just a (chef's kiss) textbook example of a data race, and a clearly unsound Go program. I don't know how or why the OP believes "this program ... [is] according to Wikipedia memory-safe" -- it very clearly is not.But, you know, I think everyone here is basically talking past each other. | ||
▲ | 4 days ago | parent | prev [-] | |
[deleted] |