News for hackers. Stuff that matters.
Re:Rust vs. C++: Fine-grained Performance by oldmanjay on Sunday February 07, 2016 @04:15PM (#11054875)
It seems you're sort of missing a big point here. You demonstrate how, with sufficient vigilance, you can write safe C++. The goal of Rust is to move the vigilance into the language and make the unsafety opt-in rather than attempt-to-run-from.
Re:Rust vs. C++: Fine-grained Performance by autoreleasepool on Sunday February 07, 2016 @04:21PM (#11054909)
> with sufficient vigilance

So now using const is some kind of difficult task? Not much cognitive overhead there. I thought everyone was onboard with immutability these days.

My point is that safe low-overhead data structures with non-dangling, pointers protected from nullptr dereferencing ARE possible in C++ and not Rust. Yes, you have to put const after every type. Call that vigilance if you want. It's a really small price to pay IMO.

Edit: Down voted again. What's wrong with my point or code? I'm curious.

Re:Rust vs. C++: Fine-grained Performance by pcwalton on Sunday February 07, 2016 @04:43PM (#11055025)
> So now using const is some kind of difficult task? Not much cognitive overhead there. I thought everyone was onboard with immutability these days.

The fact that if you make everything totally immutable you can write safe C++ is (a) not true; (b) even if it were true, a totally irrelevant point in practice since not everything can be immutable. "C++ is memory-safe if you don't mutate anything anywhere" is a completely uninteresting point to the real world (even if it were true).

> My point is that safe low-overhead data structures with non-dangling, pointers protected from nullptr dereferencing ARE possible in C++ and not Rust. Yes, you have to put const after every type. Call that vigilance if you want. It's a really small price to pay IMO.

No, it's completely wrong. You have no protection from dangling references in C++.

Re:Rust vs. C++: Fine-grained Performance by autoreleasepool on Sunday February 07, 2016 @05:07PM (#11055145)
> No, it's completely wrong. You have no protection from dangling references in C++.

I'd love to see an example without globals or an undefined behavior factory function.

Re:Rust vs. C++: Fine-grained Performance by pcwalton on Sunday February 07, 2016 @05:10PM (#11055162)
A "factory function" is just a function. Unless you have some way of statically distinguishing "factory functions" from functions, you are now arguing "you can write safe C++ if you make all your data immutable and you don't use functions". Besides the fact that this is not true (consider the destruction order for rvalues), how is this a statement that is possibly relevant to the real world?