Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

shared_ptr use is very rare in good modern C++. Uaf bugs are much rarer. Most people using modern C++ never have any, see any, or risk any. So, no, they would not be better off with GC.


> shared_ptr use is very rare in good modern C++

That's true. But if you do the preferred thing of using unique_ptr then you still happily access memory beyond the lifetime of an object via some bug.

> Uaf bugs are much rarer.

This is not true. You can go look at CVEs for large projects like Chrome that have teams of people trying to weed out these kinds of issues and still see UAFs where absolutely nothing is allocated with "new."


That's Google for you.

You cannot access memory you have no pointer to, not even accidentally.


"Never hand out non-owning pointers or references" is not, in my opinion, an acceptable design constraint for a tremendous number of systems.


Hand them out freely. Don't store them. Likewise, string_view. The go down the call chain, not up.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: