Hacker News new | ask | show | jobs
by ar15saveslives 3528 days ago
What is "memory safe" for you? If you use C arrays and raw pointers in your C++17 code, it's definitely not memory safe, but the main problem is that it's not modern C++.
1 comments

Even modern C++ isn't memory safe. Most straightforward example is to move a uniq_ptr, which makes it a nullptr, ready to be dereferenced and cause UB.
How does it happen? Non-const unique_ptr& used as a function parameter?
I can simplify your example:

  unique_ptr<int> p;
  auto n = *p; // C++ kills!