17 ms·
Well, at least with C++ you can write linked lists and other algoritms which require multiple references. Not every engineer is sloppy with use-after-free, inco
by smallstepforman 3y ago
Well, at least with C++ you can write linked lists and other algoritms which require multiple references. Not every engineer is sloppy with use-after-free, incorrect mutability, leaking resources etc. There are correct programs written in C++, the developers are not unicorns and it does not require super human effort. Kitchen knives are also unsafe and dangerous yet with their correct use we can create wonderful meals.
- pjc50 3y ago> There are correct programs written in C++ How do you know correct? Very few pieces of software are subject to full theorem-prover correctness, and very few pieces of C++ are completely free from ever invoking "undefined behavior" at runtime. Because that's extremely hard to do when even "x = x + 1" can be UB.
- AnimalMuppet 3y agoBy that standard, how do you know correct programs are written in any language? I seem to recall you praising JOVIAL a week or two ago; well, how many full theorem-prover correct programs were written in JOVIAL? I would guess, zero. Don't hold C++ programs up to a standard that programs in other languages also can't pass.
- pjc50 3y ago> I seem to recall you praising JOVIAL a week or two ago Think you have the wrong person? I have no idea what this refers to.
- AnimalMuppet 3y agoWell, I'll take your word on it. I was working from memory, not looking at a particular post. I apologize for the inaccurate claim. Back to the larger point: How many Rust programs meet your proposed level of "correctness"? How many Fortran programs, Java programs, Python programs? Virtually none of our software does. Why hold C++ to a standard that nothing else meets either?
- rhn_mk1 3y agoIMO not every coder is sloppy with use-after-free. Not everyone is slopy with incorrect mutability. [...] Not everyone is sloppy with $THING[N]. But it's hard to consistently not be sloppy in any one of them, and N are so many that almost everyone is sloppy with at least one of them, most of the time. Each probablility of a mistake may be low on its own, but they compound with every avenue to make mistakes.
- evouga 3y agoI've spent hours helping my students debug their Rust programs of incorrect array-indexing logic, incorrectly-reasoned loop invariants, incorrect conditional logic, and everything in between. They're not double-deleting raw pointers, but then again, most C++ programs don't use raw pointers these days either... "Rust makes a few classes of bugs impossible to write by construction" is a very nice feature of the language. But I'm really turned off by how insufferable the Rust community is (which shines through in the OP's blog post and several comments elsewhere in the responses): it's never the quote at the start of this paragraph; it's always "writing software in anything but Rust is fundamentally irresponsible!" or "if a Rust program compiles, it must be correct!" No, not even close.
- clnq 3y ago> Kitchen knives are also unsafe and dangerous yet with their correct use we can create wonderful meals. This is very well put and mirrors my sentiment as a long-term C++ swe. I also think that the following quote is rather misrepresentative: > C++ is a great programming language. The complaints are just from people who aren’t up to it. If they were better programmers, they’d appreciate the C++ way of doing things, and they wouldn’t need their hand-held. Languages like Rust are not helpful for such true professionals. C++ is a great language and a lot of complaints do come from people who aren't up to learn it properly. This isn't elitism, and this state of things has been true for every skill-based discipline in history. I am not saying that I am better than people who refuse to learn C++, or that C++ is a better language than others - I don't think there are many C++ programmers at all who do, it would be a very ridiculous stance. C++ is a great language, it is also a somewhat dangerous language. It is not a language for everyone and every purpose. And that is fine. Just like knives are great instruments even if they are a bit dangerous and unsafe to those who do not wish to learn it properly and where it makes sense. At the end of the day, it doesn't matter how many people who just don't see a problem with C++ one calls "elitist" or other things, not everyone is obsessed with micro-improving a language that clearly works very well.