4 ms·
They are very different in those respects, correct. But I think the point here is that both are ways of achieving memory safety.
by azakai 4y ago
They are very different in those respects, correct. But I think the point here is that both are ways of achieving memory safety.
- pca006132 4y agoSo the non-owning references are kind of like weak reference but not implemented with Rc? I guess I now understand its purpose. Wondering how does this deal with multithread though. For example, the object A might be dropped in thread 1 (increments the generation number in thread 1) and accessed in thread 2 (reads the generation number). How do they guarantee an error in this case without using atomics? (although this might not be a valid question because you can't really say A is dropped before thread 2 accessing A without some sort of synchronization...)