News for hackers. Stuff that matters.
Re:C++ creator rebuts White House warning by gigel82 on Monday March 18, 2024 @07:22PM (#39751247)
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...

Re:C++ creator rebuts White House warning by pornel on Monday March 18, 2024 @07:44PM (#39751409)
We'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.

Re:C++ creator rebuts White House warning by gigel82 on Monday March 18, 2024 @11:22PM (#39752637)
I 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.

Re:C++ creator rebuts White House warning by dralley on Tuesday March 19, 2024 @12:34AM (#39752975)
IME this is mostly a familiarity problem not an actual syntax problem.
Re:C++ creator rebuts White House warning by gigel82 on Tuesday March 19, 2024 @11:08AM (#39756510)
No, 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.
Re:C++ creator rebuts White House warning by dralley on Tuesday March 19, 2024 @01:40PM (#39758309)
Average Rust code uses a fair number of lambdas, you won't convince me that C++ has a readable / ergonomic syntax for lambdas.
Re:C++ creator rebuts White House warning by GoblinSlayer on Tuesday March 19, 2024 @03:38AM (#39753688)
See 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.
Re:C++ creator rebuts White House warning by pornel on Tuesday March 19, 2024 @08:11AM (#39754933)
See 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.

Re:C++ creator rebuts White House warning by GoblinSlayer on Wednesday March 20, 2024 @04:15AM (#39763896)
You're talking about using C the hard way, that's difficult to get right indeed, because it's the hard way.
Re:C++ creator rebuts White House warning by kstrauser on Monday March 18, 2024 @07:30PM (#39751325)
> 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.

Re:C++ creator rebuts White House warning by alphabeta567 on Monday March 18, 2024 @07:26PM (#39751290)
Right, tell me you've never made an off by one error.

Or had a dangling reference in your program.

Re:C++ creator rebuts White House warning by fnordpiglet on Monday March 18, 2024 @10:49PM (#39752474)
Safe 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.

Re:C++ creator rebuts White House warning by gigel82 on Monday March 18, 2024 @11:12PM (#39752588)
Scratch is simpler than Rust and a lot safer. That's absurd, but maybe that's where we're headed?
Re:C++ creator rebuts White House warning by fnordpiglet on Monday March 18, 2024 @11:55PM (#39752800)
It’s not very metal tho
Re:C++ creator rebuts White House warning by adgjlsfhk1 on Monday March 18, 2024 @11:09PM (#39752576)
name 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.
Re:C++ creator rebuts White House warning by gigel82 on Tuesday March 19, 2024 @11:12AM (#39756565)
There 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.

Re:C++ creator rebuts White House warning by b20000 on Tuesday March 19, 2024 @12:14AM (#39752891)
agree not sure why this is downvoted
Re:C++ creator rebuts White House warning by hgs3 on Tuesday March 19, 2024 @12:40AM (#39752997)
> 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.