Hacker News new | ask | show | jobs
by AlotOfReading 965 days ago
C++ with RAII doesn't make the language safe, it makes it less unsafe. Instead, we have 25 years of incremental language additions without meaningfully deprecating things. The officially sanctioned way to write memory-safe code in C++ is a non-existent set of compiler warnings that error when you use 80% of the language (profiles). To quote Stroustrup and P2410 [0]:

    "Experience shows that this [memory safety] cannot be done without static analysis and run-time support. Furthermore, for fundamental reasons this cannot done even with such support if arbitrary legal language constructs are accepted while conventional good performance must be maintained."
[0] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p24...
1 comments

We are comparing to C here, which is clearly even more unsafe!