sure, maybe, but performance doesn’t matter for deciding if a language is memory-safe or not. And C++ isn’t memory-safe by any commonly used interpretation of that word.
You may of course decide that the downsides of memory-safety aren’t worth it for your use-case, that is a separate issue
I think it boils down, how we define “memory safe”. C++ is perfectly memory safe, if you know what you’re doing. A lot of people don’t. Which is why Rust was born. that doesn’t make C++ a memory-unsafe language. It just demands more responsibility from the user. A design philosophy that comes with a lot more flexibility than Rust can offer.
Which is fine. Both languages have their perks. But saying C++ isn’t memory safe, while Rust is, is in my opinion just plainly wrong. Besides, with “unsafe” Rust inherently already the door for memory issues.
Modern C++ practises and dev patterns can handle most memory issues in C++ pretty easily. Consider smart pointers for example, or RAII.
It’s not the language’s fault if it is used wrong.
You’re right. Thanks for the links. Although I still think that C++ provides the tools to enable memory-safe programming, I guess the lack of enforcement makes it inherently memory-unsafe.
Which language would you say is not memory safe then? Is there any serious language out there where you should expect memory issues if you don’t make any mistakes?
If the standard is “you know what you’re doing and never make mistakes”, then all languages are memory safe. All you’re doing is arguing against memory safety as a concept by redefining the term in such a way that it becomes meaningless.
sure, maybe, but performance doesn’t matter for deciding if a language is memory-safe or not. And C++ isn’t memory-safe by any commonly used interpretation of that word.
You may of course decide that the downsides of memory-safety aren’t worth it for your use-case, that is a separate issue
I think it boils down, how we define “memory safe”. C++ is perfectly memory safe, if you know what you’re doing. A lot of people don’t. Which is why Rust was born. that doesn’t make C++ a memory-unsafe language. It just demands more responsibility from the user. A design philosophy that comes with a lot more flexibility than Rust can offer.
Which is fine. Both languages have their perks. But saying C++ isn’t memory safe, while Rust is, is in my opinion just plainly wrong. Besides, with “unsafe” Rust inherently already the door for memory issues.
Modern C++ practises and dev patterns can handle most memory issues in C++ pretty easily. Consider smart pointers for example, or RAII.
It’s not the language’s fault if it is used wrong.
https://en.m.wikipedia.org/wiki/Memory_safety
https://www.memorysafety.org/docs/memory-safety/
https://media.defense.gov/2022/Nov/10/2003112742/-1/-1/0/CSI_SOFTWARE_MEMORY_SAFETY.PDF
https://www.cisa.gov/news-events/news/urgent-need-memory-safety-software-products
why do you want to redefine what the term means? why does it hurt to admit that C++ is not memory safe? It’s not about your weakness.
You’re right. Thanks for the links. Although I still think that C++ provides the tools to enable memory-safe programming, I guess the lack of enforcement makes it inherently memory-unsafe.
Point taken, I’ll stop saying that.
Which language would you say is not memory safe then? Is there any serious language out there where you should expect memory issues if you don’t make any mistakes?
No. I changed my mind just very recently throughout this discussion.
I agree now that the lack of enforcement of memory safe techniques in C++ makes it inherently memory-unsafe.
That doesn’t change the fact though that it’s possible to write memory safe code, if you know what you’re doing, use the right patterns, classes etc…
If the standard is “you know what you’re doing and never make mistakes”, then all languages are memory safe. All you’re doing is arguing against memory safety as a concept by redefining the term in such a way that it becomes meaningless.
Yupp. I’ve changed my stance on this.
Since C++ doesn’t enforce memory safe programming paradigms, it is inherently memory unsafe.