Hacker News new | ask | show | jobs
by dingo_bat 2971 days ago
Of course same is true for modern cpp.
1 comments

Modern C++ does not mandate that every value be a valid instance of its type wherever it is theoretically accessible, so I'm not sure why you're saying modern C++ fixes this. Actually, the fact that Rust does is something people somewhat regularly complain about. It is a heavy-handed performance / code complexity vs. safety tradeoff that certainly fixes this bug, which I think is a pretty reasonable thing to point out.
D also addresses buffer overflows in a mechanically checkable manner.
If you follow C++14 core guidelines, the defect described would not have occurred. The bug at its core is usage of unsanitized input data. You don't need to "mandate that every value be a valid instance of its type wherever it is theoretically accessible", however that may differ from simple sane C++14 paradigms.

OPINION ALERT: Honestly guys get over rust, it does not offer a single advantage in real-life programming scenarios.

I disagree with people who think Rust is a savior, but it does have plenty of advantages in some areas over C and C++, especially for novices.
So I have to read a 21762 line document just to avoid shooting myself on the foot?

There's a Rust advantage right there.

Who said anything about reading a document?
The guidelines seem like a document to me: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppC...
You don't have to read them. The compiler will enforce them.