Earlier quoted context omitted.
Good risk management is about cost vs payoff analysis. To address the risk of car accident, first you stop juggling chainsaws while driving, then you start to wear seatbelts, and then you start thinking about how the remaining inevitable driving mistakes can be mitigated through technology or practices.
Sure. And the best "insurance" is having competent programmers.
I cannot consistently write safe C/C++ code
11–20 of 123 posts
Re: I cannot consistently write safe C/C++ code
#12Earlier quoted context omitted.
Good risk management is about cost vs payoff analysis. To address the risk of car accident, first you stop juggling chainsaws while driving, then you start to wear seatbelts, and then you start thinking about how the remaining inevitable driving mistakes can be mitigated through technology or practices.
Sure. And the best "insurance" is having competent programmers.
Do they fix all problems? Of course not. Neither does a hard hat.
Re: I cannot consistently write safe C/C++ code
#13Re: I cannot consistently write safe C/C++ code
#14> I cannot consistently write safe C/C++ code. I'm not sure how to interpret what this means. What do "consistent" and "safe" mean? Is safety about not corrupting program data? Even when dealing with Python arrays, I can end up corrupting my arrays one way or another (off by one, race conditions, etc.). Is "consistent" about going days without a bug? Because I can't do that in any language. If not, what do these mean…
In all of them is possible to introduce logical bugs.
The problem with C and its derived languages is that not only one has the logical bugs common to all programming languages, there are the memory corruption and UB introduced bugs to worry about as well.
While one can think as being super competent, make use of all tools to reduce such error cases, there are always situations where such errors get introduced due to fatigue, project pressure, continuous interrupts.
Additionally since most of us don't work alone, the actual code quality is an average of everyone that has ever worked on the code, and not everyone shares the same goals regarding quality of their work.
I share the feeling with the author, always tried to follow C and C++ best practices, when coding in C I adopted or evangelized tooling, safety standards or known books that lead to safer code.
Yet, like everyone else I had my share of memory corruption issues back on my C and C++ days.
One anecdote was trying to find out a memory leak that was bringing down a server in production, with the customer calling technical support every single day.
It took one week to track it down, and it wasn't something I would advise anyone to experiment.
Re: I cannot consistently write safe C/C++ code
#15I think this whole "competent coders don't make mistakes" is a testament to the immaturity of the software development world. Real men write in assembly, maybe C if they're a bit tired. It would be like a construction worker saying "only noobs need a hard hat" or a surgeon refusing to wash their hands because they're careful never to touch anything contaminated. Or maybe simply refusing to wear your seatbelt because…
root@boxen:~# cat > a.outRe: I cannot consistently write safe C/C++ code
#16I think this whole "competent coders don't make mistakes" is a testament to the immaturity of the software development world. Real men write in assembly, maybe C if they're a bit tired. It would be like a construction worker saying "only noobs need a hard hat" or a surgeon refusing to wash their hands because they're careful never to touch anything contaminated. Or maybe simply refusing to wear your seatbelt because…
There's a bit of folklore that I can't remember correctly. One of the seven steps to becomming a hacker (in the pejorative sense) is this kind of overconfidence, not to make mistakes.
The last step is (the believe in) complete controle and omniscence. Another one, I guess, is insomnia.
It hang as a poster in informatics class - fond memories.
Re: I cannot consistently write safe C/C++ code
#17Yet another subtle pro-Rust rant against C. Programming is hard, and writing safe code requires knowledge, not just in C, but in every single language. Even in formal-validable languages you can make mistakes: may be you'll not make errors by using sprintf, but can make others because of using a more complex language.
Re: I cannot consistently write safe C/C++ code
#18For anyone that thinks this, you might be interested to find that DJB himself apparently thinks C, or at least the current state of C as implemented by the common compilers, is untenable for important, long lived software.[1] At least, that's how I interpreted his position. He was responded to as you would expect, unfortunately.
Credit where it's due. [2]
1: https://groups.google.com/forum/#!msg/boring-crypto/48qa1kWi...
Re: I cannot consistently write safe C/C++ code
#19I think this whole "competent coders don't make mistakes" is a testament to the immaturity of the software development world. Real men write in assembly, maybe C if they're a bit tired. It would be like a construction worker saying "only noobs need a hard hat" or a surgeon refusing to wash their hands because they're careful never to touch anything contaminated. Or maybe simply refusing to wear your seatbelt because…
> Real men write in assembly, maybe C if they're a bit tired. root@boxen:~# cat > a.out
# zcat > /dev/kmem