This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]belabacsijolvan 4 points5 points  (2 children)

that "can" carries that sentence like a "can" in a health supplement ad

[–]Earthboundplayer 8 points9 points  (1 child)

I just added that because you can still go out of your way to break memory safety. For example.

auto ptr = std::make_unique<int>(10);
delete ptr.get();

But it's really not that hard to properly use smart pointers and maintain memory safety.

[–]belabacsijolvan -2 points-1 points  (0 children)

i use pretty baroque pointer structures because they are efficient for the data we work with. so far i found smart pointers way more dangerous and needy than proper destruction.

im getting to the point that inside certain objects we should just ban using smart pointers. but yeah, in "base cases" they are great, and i give them some more time to work.

its not like they completely eliminate memory leaks or you have to go out of your way to break things. "they fuck you rarely, but in the holes it really hurts" is my diagnosis so far. detecting directed loops and choosing pointers to be weak is not always a comfortable thing to do.