Skip Navigation

Posts
0
Comments
430
Joined
1 yr. ago

  • Reminds me of the Epicurean Paradox:

  • Really? That's news to me.

  • No, but it's a first class carcinogenic.

  • Simpler said than done. Of course I agree with you, but we need deeper changes in our society, in our behaviour as people. If you get told time and time again, that you're worthless, can't achieve anything etc. that's going to leave a mark. Sure, encouraging to not let that dominate one's thoughts is a useful skill. But it shouldn't be necessary in the first place.

  • Reminds me of Sabine Hossfelder, a physicist, who had made some similar experiences.

    https://youtu.be/LKiBlGDfRU8

    Proof that educated people can still be immensely stupid and be utter human trash.

  • The definition of "a memory safe programming language" is not in debate at all in the programming community.

    Yes, my mistake. I'm sorry.

    This is incredibly arrogant, and, tbh, ignorant.

    You've willingly ignored the remaining part of that context, where I explicitly admitted problems in common usage. It was not my intention to come across as arrogant.

    there is no language construct in place to protect from these trivial memory safety issues

    Depending on what you mean by "language constructs": there are, e.g. RAII or smart pointers. But they aren't enforced. So it's correct to say that C++ is inherently memory unsafe due to the lack of such enforcements. The discussions here changed my opinion about that.

  • Yupp. I've changed my stance on this.

    Since C++ doesn't enforce memory safe programming paradigms, it is inherently memory unsafe.

  • You've missed the context. There are occasions in Rust where you have to use more boilerplate code which you wouldn't have to implement in C++ to that extent.

    But saying that C++ is free of boilerplate is of course ridiculous, if you are not able to heavily leverage templates, CRTPs, macros and alike.

  • Yes. I stopped now. I was hinted towards the usual definition of memory safe languages at another point in this discussion.

    Although it is perfectly possible to write memory safe code in C++, I agree that the lack of enforcement makes it inherently unsafe.

  • 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..

  • I'm not. But in my experience, using memory safe programming patterns, classes and possibly additional testing and analasys tools do the job quite well.

    But yeah. I changed my mind about this memory-safety-property. The lack of enforcement really does make C++ inherently memory unsafe.

  • 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.

  • does not warn anywhere

    This is incorrect. If you properly test your code such errors will become visible. It's not too much of an ask to conduct systematic software testing. You should do it anyway regardless of the language used.

    you are really thinking that you are the perfect coder who jever makes any mistakes. It does not make sense to argue with you

    You are quick with being judgemental and ignoring the rest of what I said in that part, which is why I agree with you. This discussion is no longer productive.

  • I hope they feel welcomed here to stick around. I've quit Reddirt in 2023 during the API exodus, came to Lemmy and never looked back.

  • This is such a weird take. C++ isn't memory safe. The blanket statement is... true. You say as much in the second sentence.

    I suppose we need to make definitions clearer. C++ is memory safe in the sense that you can write memory safe code. It doesn't enforce memory safety though. But not doing that is not the language's fault. If someone jumps with a bike from a flying airplane, it's not the bike's fault that they will not land safely. It's the misuse of the bike.

    The best developers money can buy still make mistakes with C and C++.

    I'd argue those weren't the best developers then. However, I don't want to get ridiculous. I see that there are problems in the common use of C++. Although I can't share that from my experience due to usually proper usage, thorough testing use of additional tools, there is surely a need for aiding C++ devs with writing safe code. I know of the corresponding security concerns as well as probably everyone else in the C++ community.

    There are proposals to improve on that. Some of those might already come with C++26. Stroustrup's favourite are Profiles to provide and enforce further guarantees, while others propsed an extension like Safe C++. Whereever the future will take us with C++, I'm confident that this issue will be sufficiently solved one day.

    There was a time when C++ wasn't even designed for multi-processor systems, lol. That was redesigned pretty late. Much has changed and it will continue to improve as C++ continues to mature.

    Edit: Just saw your convention examples after I've sent my reply. Idk why it wasn't displayed before.

    Regarding the double free: It's clear from the documentation that this returns a raw pointer.

    Regarding the use after free:
    I really don't want to sound arrogant as this is a simple example of course, but that is such an obvious mistake and looks like a topic which is covered in C++ beginner classes. To me, this is almost on the same level as dividing by zero and wondering about resulting bugs.

    but the developer needs to know all of them to not make the mistake

    Yes. Not every language is as user-friendly as python. With more flexibility come more risks but also more rewards if you've mastered it. It depends on what you want to do and how much you're willing to invest. I would at least expect a professional dev to rtfm. Which itself is apparently already a problem. But, in the end of the day we want to use tools, which are effective and easy to use. So sure, point taken. I refer to the section before my edit regarding developments upon improving such aspects in C++.

  • Another type of plastic though than the ones used for typical drinking bottles. I can imagine they are more robust. But it would be really good to know the microplastic intake through such plastic pipes.

  • I suppose so. Even though they already melt at typical frying or baking temperatures, they don't evaporate. Even if, the still need to find a way through the food outside and not get trapped inside, where they'll cool down again and therefore return to a solid state.

    Take this with a grain of microplastic-free salt, as this is not my field.

  • I've a very long track record using C++ as well and I can't share the feeling. I don't say it's alyways easy. I'm just saying that it's doable and therefore whether the software is memory safe depends on the expertise of the devs. Modern C++ practises, programming patterns and as well tools from the STL (or even your own implementation) make life a lot easier. If you don't use them, that's not the languages fault. In the end, how you use the language still matters a lot. If you'd like to think less about memory management, go on and use Rust or C# or Java or even Python if performance doesn't matter. That's perfectly fine. This can come with other issues, like more boilerplate in the case of Rust for example, but in the end those languages are tools. Choose the tool which gets your job done.

  • 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.