3 ms·
Aren’t C++ newcomers embracing “modern C++”? Touching new and delete is a feature for advanced users. Most newcomers can exist happily solely with STL container
by bluetomcat 3y ago
Aren’t C++ newcomers embracing “modern C++”? Touching new and delete is a feature for advanced users. Most newcomers can exist happily solely with STL containers, RAII and smart pointers.
- harrid 3y agoFor some reason, the comparison is always current rust Vs 20 year old c++. Mentioning that "modern" (12 year old) c++ does not have these problems gets downvoted. Completely unrelated: there are at least two dedicated anti c++ communities.
- littlestymaar 3y ago> Mentioning that "modern" (12 year old) c++ does not have these problems gets downvoted. Because it's false, that's why. Modern C++ still has many/most of C++ problems. It solves a bunch of them, but far from all. And telling the opposite to newcomers is a lie that's hurting them because they can end up making even more mistakes than the previous generation, since they were told they didn't have to pay attention thanks to “modern C++”.
- tubthumper8 3y ago> Mentioning that "modern" (12 year old) c++ does not have these problems gets downvoted. I'm not a C++ user but I thought that all of these things are still in "modern" C++, that the new editions only add things, not remove? Are there tools that can automatically rewrite existing code to use the "modern" features?
- harrid 3y agoAnd that's a criticism I can take to a degree on behalf of the language. These relics are still in because mistakes are happening in the governing body. However in practice, they don't matter much. Every CPP dev has a little helper running in the background which immediately flags these mistakes and can auto correct them. It's not an issue, just an annoyance.
- littlestymaar 3y agoThe beauty of C++ is that you can still shoot yourself in the foot when using smart pointers.
- JoeAltmaier 3y agoHell, you can use a null pointer in Java. Nothing new there.
- littlestymaar 3y agoNull pointers in Java leads to exception, null pointers in C++ leads to UB, which can be exploited. All bugs aren't born equal.
- smaudet 3y agoThis is like saying your neighbors siding is off color while your own is falling off and the framing is rotting. Both are problems with siding, one is far more serious than the other. I'm not a fan of Java, but cpp people being disingenuous is a pet peeve. "Modern" cpp still sucks, it just sucks less - it's not useful to pretend otherwise.
- JoeAltmaier 3y agoYes, but at some point, broken is broken. Our cloud service at Sococo, back in the day, their principle bug-tracing activity was Java null pointers. The second? leaks. Both problems with pointer management. However you slice it, it takes discipline to get memory allocation right. No magic bullet.
- yencabulator 3y agoNeither null pointer exceptions nor memory leaks tend to lead to data corruption or security vulnerabilities.
- JoeAltmaier 3y ago