News for hackers. Stuff that matters.
Re:Cross-platform Rust rewrite of the GNU coreutils by pcwalton on Tuesday March 22, 2016 @06:03PM (#11340304)
> Keep in mind, of those 35 years, it only makes sense to consider the last decade-onward (or so) in comparison. While the language hasn't changed a whole lot, programming methodologies certainly have.

The last decade has seen an explosion of modern C++ code using best practices that routinely exhibits the same memory safety issues. C is worse.

> There are definitely issues with C no doubt--but so many people say C is dangerous and difficult when in fact they don't even practice using the language.

I practice C all the time and I think it's dangerous and difficult. I've seen so many brilliant programmers accidentally create game-over RCEs via use after free, for example.

Re:Cross-platform Rust rewrite of the GNU coreutils by AnimalMuppet on Tuesday March 22, 2016 @06:38PM (#11340498)
> The last decade has seen an explosion of modern C++ code using best practices that routinely exhibits the same memory safety issues.

Examples? I'd be surprised if best practice C++ (C++11, say) had memory safety issues. (I realize that's only the last half-decade...)

> C is worse.

Certainly. Lack of destructors alone makes it hard to create safe abstractions.

Re:Cross-platform Rust rewrite of the GNU coreutils by pcwalton on Tuesday March 22, 2016 @06:56PM (#11340607)
> Examples? I'd be surprised if best practice C++ (C++11, say) had memory safety issues.

Pwn2Own last week. For more examples, search any browser engine's bug tracker.

Yes, this is all modern C++.

Re:Cross-platform Rust rewrite of the GNU coreutils by AnimalMuppet on Tuesday March 22, 2016 @07:33PM (#11340826)
> Yes, this is all modern C++.

Is it? You're telling me that all code in all browsers have been re-written into C++11 (or C++14) with best practices? I don't believe you. At a minimum, I'm going to need some documentation before I believe that.

[Edit: I'm not trying to pull a No True Scotsman here. I just doubt that browsers have been completely rewritten into modern C++, or with anything approaching best practices. I've seen how long old code lives to believe it without some supporting evidence.]

Re:Cross-platform Rust rewrite of the GNU coreutils by pcwalton on Tuesday March 22, 2016 @10:54PM (#11341785)
Most exploits tend to be in new code (contrary to popular belief), which in all modern browsers is written in modern C++. The WTF (Blink/WebKit) and the MFBT (Firefox) are state-of-the-art template libraries; you are free to search for those libraries and verify for yourself. New C++11 features such as rvalue references do nothing to avoid memory safety problems; in fact, they make them worse, since "use-after-move" is now a problem whereas it wasn't before.

I know it's hard to believe, but C++ is not memory safe, old C++ or modern C++, in theory or in practice. The new C++ features do effectively nothing to change this. As far as use-after-free goes, C++ basically adds safety over C in two places: (1) reference counting is easier to use and is easier to get right; (2) smart pointers are arguably somewhat less likely to get freed before accessed again due to the destructor rules (though I think (2) may not be true in practice). Browsers have been making use of these two features for a very long time.

Bringing up modern C++ here is "no true Scotsman" unless you can point to a specific C++11 feature that browsers are not using that is a comprehensive solution to the use-after-free vulnerabilities they suffer from. There is no such feature I am aware of.

Re:Cross-platform Rust rewrite of the GNU coreutils by AnimalMuppet on Wednesday March 23, 2016 @11:29AM (#11345328)
No, I wasn't asserting that there is some magic C++ feature that the browsers aren't using. "Most exploits tend to be in new code" was the piece of your argument that I was missing.
Re:Cross-platform Rust rewrite of the GNU coreutils by wangchow on Tuesday March 22, 2016 @06:16PM (#11340368)
Well, you are probably right. :)

I am certainly biased as I enjoy procedural languages for their simplicity. So many constructs in the others. As the saying goes, C++ is my favorite 4 languages. I hope that doesn't become the fate of Rust. Go-Lang seems to get that part properly then that's probably debatable.