3 ms·
> [Rust is] absolutely more productive than C++ ... I have spent strictly more time in the last five years filing compiler bugs than chasing memory usage error
by ncmncm 5y ago
> [Rust is] absolutely more productive than C++ ...
I have spent strictly more time in the last five years filing compiler bugs than chasing memory usage errors in my C++ code. So, whatever benefits the extra work needed to make rustc happy, and time waiting on slow, slow builds is supposed to deliver, it fixes no problem I have.
The same is probably true for anybody coding C++ using modern library facilities. There is just no temptation to do anything dodgy. It would be more work than the safe thing.
So, the marketing insists on these benefits, but I don't see them. It is likely old code was more prone to such bugs, but we are talking about coding now, not then.
Rust has lots of nice features to make coding pleasant, and you can evidently get used the nannying, so it seems like an OK choice for a project that nobody else will need to maintain.
- zozbot234 5y ago> The same is probably true for anybody coding C++ using modern library facilities. There is just no temptation to do anything dodgy. std::string_view is but the latest example of a "modern" C++ facility that turns out to be a dodgy footgun, due to the lack of safeguards around lifetime errors. C++ still lacks a general equivalent to string_view for arrays (what Rust calls a slice) for the same reason. These seem like significant drawbacks to me.
- 10000truths 5y agoC++ does have this, it’s called std::span. https://en.cppreference.com/w/cpp/container/span https://en.cppreference.com/w/cpp/container/span
- pjmlp 5y agoJust make /analyze part of the compiler options and some of those issues will be visible.
- kobebrookskC3 5y ago> I have spent strictly more time in the last five years filing compiler bugs than chasing memory usage errors in my C++ code. maybe because your code isn't worth having people actively attack?
- jandrewrogers 5y agoMy experience is the same as theirs. In recent years I've run into more compiler bugs than memory bugs in the large, complex C++ code bases I work with. It makes sense. A common use case for C++ today is writing high-performance software, where the software architecture is likely to be schedule-driven (e.g. thread-per-core, userspace I/O, etc). In these cases, you see minimal heap allocation, shared structures, or locking. Modern C++ is pretty safe by default for this; it allows you to do unsafe things, and to do safe things that the Rust compiler deems unsafe, but there isn't a cabal forcing people to write non-idiomatic unsafe C++ code in software architectures where the code is naturally almost entirely single-threaded and with few heap allocations. The most insidious bugs I see in modern C++ code bases are scheduling bugs e.g. logical or behavioral edge cases due to pure async execution, which can be very subtle. Rust doesn't help with that.
- kobebrookskC3 5y agois your code as actively attacked as a web browser or iOS?
- tempodox 5y agoGood luck getting Apple to rewrite iOS in Rust, so at least that part of your argument is pointless.
- kobebrookskC3 5y agono, just clarifying the difference between not encountering bugs and not having them.
- tempodox 5y agoThen you should have said that. This actually makes sense. Apart from that, everyone even half competent would know that and make a trade-off involving other factors. Being dogmatic about a single facet isn't helpful.