Re:C++ is a hack
by maccard on Tuesday February 16, 2016 @12:42PM
(#11111628)
I don't think the parent meant free as in "free()" - more along the lines of.
[ Parent
| on HN ]
Re:C++ is a hack
by dragontamer on Tuesday February 16, 2016 @01:23PM
(#11111945)
But if "Foo" was composed of unique_ptr (or shared_ptr), then those smart pointers would be nulled out after the std::move (due to the default move constructor)
So again, unless Foo f was composed of "raw pointers", even that kind of code is safe from "use after free" vulnerabilities.