6 ms·
I agree; you can write perfectly safe and noncompromisingly performant code in C++ much better than any language today. It's genuinely difficult to understand
by gigel82 3y ago
I agree; you can write perfectly safe and noncompromisingly performant code in C++ much better than any language today.
It's genuinely difficult to understand why Rust gets rammed down everyone's throats lately; do they really think developers coming out of universities today are too stupid to grasp memory management? If that's the case, why not have everyone code in Scratch?
That memo reads like "to avoid wet pants, everyone should now pee sitting down"; some of us can aim...
- alphabeta567 3y agoRight, tell me you've never made an off by one error. Or had a dangling reference in your program.
- kstrauser 3y ago> It's genuinely difficult to understand why Rust gets rammed down everyone's throats lately; do they really think developers coming out of universities today are too stupid to grasp memory management? Yes. Experimentally, that is absolutely correct. New programmers are bad at memory management. So are old ones. So are experts, unless you seriously want to argue that the OpenBSD gang are a bunch of amateurs. The best C/C++ programmers in the world still write code with memory flaws today. At some point you have to say, you know, maybe it's not the programmers that are the problem.
- pornel 3y agoWe've been trying the "just don't write bugs" strategy for over 40 years now, and it's not working. Framing this as a problem with people being too stupid is a completely unproductive mix of hubris and elitism. In the disciplines where real safety is required (like engineering, aviation, medicine), it's accepted that people will make mistakes. When a system can fail catastrophically due to a simple human error, it's the system that is broken, and needs to be made more robust.
- gigel82 3y agoI didn't say people are too stupid. On the contrary, we onboard fresh grads onto our large C++ code base every once in a while and they all seem to grasp the concepts just fine. I'm wondering if most folks throwing shade at C++ had used pre-C++11 toolsets and just have bad memories of the experience. FWIW, I find modern C++ genuinely great to read / easy to parse by humans (same for similar languages like C#, Java, JavaScript/Typescript) whereas reading Rust (in particular function definitions) is painful.
- dralley 3y agoIME this is mostly a familiarity problem not an actual syntax problem.
- gigel82 3y agoNo, I mean humans in general, not software developers. Seriously, show a non-developer a printout of some average modern C++ code and some average rust code and see which one they think is easier to read and more visually pleasing.
- dralley 3y agoAverage Rust code uses a fair number of lambdas, you won't convince me that C++ has a readable / ergonomic syntax for lambdas.
- GoblinSlayer 3y agoSee log4j vulnerability, you still need "just don't write bugs" with safe languages. What was really tried was "use C the hard way", which fails regularly as one can expect. Projects that use C the easy way have much better safety.
- pornel 3y agoSee ShellShock. Having memory safety vulnerabilities doesn't prevent other bugs. C and C++ projects still have logic errors, broken auth, XSS, SQL injection, and do dangerously dumb stuff, and that's on top of buffer overflows, user-after-frees, data races, and UB footguns. Nobody promises that memory safety will fix all bugs, but it can prevent or significantly reduce a class of vulnerabilities, and reduce the total number of serious defects. And then time and effort saved on dealing with memory corruption bugs can be redirected towards dealing with all the other higher-level issues. > Projects that use C the easy way have much better safety. That's just another way of blaming programmers for not writing C without the bugs. Every language can be perfectly safe if used correctly — even hand-written machine code. The problem is that it's easy to say "use C the easy way" (whatever that means), but actual real-world uses don't live up to such standard, and even the best programmers can make mistakes. Language safety is about making programs safer even when programmers write less-than-ideal code.
- GoblinSlayer 3y agoYou're talking about using C the hard way, that's difficult to get right indeed, because it's the hard way.
- fnordpiglet 3y agoSafe modern c++ is poorly understood compared to the decades of experience and knowledge corpus around old practices. The unsafe ways are still easily accessible and widely used, taught, and understood. C++ also is laden with complexity and idiomatic styles, immense foot cannons, etc. Rust is fairly explicit with what’s unsafe (ie unsafe) and safety is default. It’s also generally a simpler language overall with less accretion of backwards compatibility. There aren’t decades of bad habits still usable in rust. It’s got modern sugar, first class functional constructs, and it’s generally cooler in the way metal was cooler than big band was in 1988.
- gigel82 3y agoScratch is simpler than Rust and a lot safer. That's absurd, but maybe that's where we're headed?
- fnordpiglet 3y agoIt’s not very metal tho
- adgjlsfhk1 3y agoname one piece of open source software in C or C++ with more than a couple thousand commits that has not had to fix a memory safety bug.
- gigel82 3y agoThere are millions of pieces of software in C or C++ with more than a couple thousand commits, whereas with rust there are maybe a handful (the rust compiler itself, Servo, Deno, and... ?), and I bet they all had to fix memory safety bugs (except I guess we call them "soundness issues" in Rust). This argument reads like the old "Linux / macOS is safer than Windows, look at all the malware that targets Windows" while ignoring that at the time Windows had 95%+ market share for desktop.
- b20000 3y agoagree not sure why this is downvoted
- hgs3 3y ago> It's genuinely difficult to understand why Rust gets rammed down everyone's throats lately Most software companies have a revolving door of developers and they need cookie cutter tools to limit the damage a "bad" developer can cause. In the 1990's Java OOP was hyped as the solution to procedural spaghetti code (because it is impossible to architect good software without objects), in the 2010's it was web frameworks (because it is impossible to build a web app without a framework), and in the 2020's it is Rust (because it is impossible to write C/C++/Assembly without memory bugs). The Rust hype cycle is yet another Big Corp push for more guardrails.