3 ms·
> I believe the situation is the same in C++, in the specific case of shared_ptr, which are a small part of codebases, if they are even used - for instance an
by jcelerier 6y ago
> I believe the situation is the same in C++,
in the specific case of shared_ptr, which are a small part of codebases, if they are even used - for instance an immense amount of C++ GUI programs use Qt which doesn't use shared_ptr-like ownership semantics but instead a tree-of-objects model which does not have this issue. In contrast in Java / C# any object that has a reference to another is at risk.
- steveklabnik 6y agoSure. That’s why I said “more deterministic.” But even a rare event disproves the guarantee.
- DougBTX 6y agoSorry, I meant that the behaviour is guaranteed, not that the destructor is guaranteed to be called. So in the Rc cycle example the guarantee is that the destructor won’t be called.
- steveklabnik 6y agoAh, then I misunderstood you, yes. My bad!