3 ms·
Has anyone done any in depth explorations of the safety and security of rust code vs well written C or C++?
by lj3 9y ago
Has anyone done any in depth explorations of the safety and security of rust code vs well written C or C++?
- hashmal 9y agoit's all in the "well written" part. of course well written C/C++ is good. the very point of Rust (and others, like Ada) is to admit that we, programmers, cannot do good work all the time. anyone thinking "I'll just write these 50k SLOC very well so it'll be ok" should not consider a career in programming.
- sqeaky 9y agoWell written the hard part there. I am riding on on the idiomatic C++11/14/17 train right now. Life over here is great, but I can the warts of the language looking backwards. The promised land in the future doesn't look quite as bright as the promises Rust offers. The only thing keeping me from trying it is the giant codebases in my current projects.
- pjmlp 9y ago> I am riding on on the idiomatic C++11/14/17 train right now. How do you see it? Nowadays I only use C++ on hobby projects or when Java/.NET need some kind of integration work. To me it seems that as code bases grow organically, it will become very hard to get which code is in which ANSI version, specially problematic given some of the changes that took place between standard revisions.
- sqeaky 9y agoAt both of my jobs, I am working way too much, I am working in pre-C++11 codebases which now allow C++11. Both are working to for -Werror everywhere and that helps a huge amount, and we can try to get more warning listed and make broad but subtle changes to the codebases. At one place we are in a race before a tight deadline and at the other we are breaking a large monolith into smaller packages. At one place we implement a new practice for all our code, and at the other we implement all our best practices as we chop code out of the monolith. Both places are seeing a reduction in bugs. The place with the packages is probably reaping a larger benefit because they are aggressively re-working old code and have better test coverage and can do so with confidence. Code bases do grow organically, but like places they can be tended and pruned to make impressive orchards or topiaries or left to the wild to become impassible jungles. Tools like RAII, exceptions, classes, etc... are just tools for managing this. I think the tools in C++11/14 are at least as powerful as in any language except perhaps Rust. Every time I hear a C developer say "C can be just as safe..." I am imagine a person with nothing but a pocket-knife trying to manage a whole forest.
- pjmlp 9y agoThanks for the overview.
- hyperpape 9y agoI've never seen anything in-depth, but there's a lot scattered throughout pcwalton's comments on HN. For instance: https://news.ycombinator.com/item?id=7587978 https://news.ycombinator.com/item?id=7587978.