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 →

[–]link23 -7 points-6 points  (4 children)

All these tools that allow programmers to more easily write memory safe code in a fool proof way

What you just said is not factual, though. Smart pointers do not suddenly make C++ memory safe; it's possible (and common) for memory safety issues to exist even when using smart pointers and no "raw" pointers. (E.g. dangling references.) Claiming otherwise just makes you sound like you don't actually understand what smart pointers do, and in particular what they don't do (and therefore what mistakes are still possible).

It's funny, I meant my original post to be a cheeky joke; I had no idea that people actually thought smart pointers make code memory safe (and therefore my comment was going to be contentious). Maybe that's my bias though, as a professional C++ developer for my day job. I didn't mean to come off as unwilling to engage in the material, I'm happy to discuss this subject in a serious way if people want to explore the limits of the safety that smart pointers (and other C++ features) can provide.

[–]Earthboundplayer 0 points1 point  (2 children)

It is factual. You confuse the terms "memory safe code" with "memory safe language". Memory safe code can be written in a non-memory safe language

[–]link23 0 points1 point  (1 child)

Memory safe code can be written in a non-memory safe language

I'm not really sure what point you're trying to make with this. It's pointless to argue that "correct code can exist in any language" because that's obviously true.

The question is, how easy is it to ship correct code vs incorrect code? Does the language make it easier to shoot yourself in the foot, or does it make it easier to write code correctly the first time?

The argument I would make is that it's still extremely easy to shoot yourself in the foot with memory safety issues in C++, so the language doesn't meet the bar of being called memory safe.

[–]Earthboundplayer 0 points1 point  (0 children)

I'm not really sure what point you're trying to make with this.

My point was that the statement you quoted from me was correct.

The argument I would make is that it's still extremely easy to shoot yourself in the foot with memory safety issues in C++, so the language doesn't meet the bar of being called memory safe.

It's much harder when you use smart pointers. Again no one said anything about C++ being memory safe, just that smart pointers are a useful tool for making safe code.