2 ms·
C++ is a language that allows any kind of memory manipulation, if you really want (or need) to do it. So your example doesn't prove anything about the adequacy
by coliveira 12y ago
C++ is a language that allows any kind of memory manipulation, if you really want (or need) to do it. So your example doesn't prove anything about the adequacy of shared_ptr in particular.
- pjmlp 12y agoMy point was that if a language does RC via library types that exposure the pointer that they own, there is no safety guarantee about memory safety. It is impossible to prove that all memory access to a given address are done via the RC wrapper object, specially in the presence of third party libraries in binary form. Sadly due to its C compatibility, there is no way around this in C++. This is mostly a problem in large projects with various skill levels across team members, having high attrition levels.
- coliveira 12y agoAs I mentioned above, the goal of C++ is not to provide memory safety guarantees. What it provides is a mechanism for RC implementation. You're free to use or misuse it if you want. It will work only for those objects that you think should be managed with RC, nothing more or less.