3 ms·
It's trivial to write an incorrect program in C because its a language that expects you, the programmer, to know what you're doing. I assume that if you're goin
by agentultra 11y ago
It's trivial to write an incorrect program in C because its a language that expects you, the programmer, to know what you're doing. I assume that if you're going to use the `fork()` and `kill()` syscalls on your OS that you're going to read about them and consider their consequences... not write the first trivial example that comes to mind and ship it.
An example program written like that is not endemic to C or a logical consequence of its design. It's ignorance. Such examples frustrate me too. It's practically a straw-man argument.
> By the way, you can also write your own wrapper functions in C
And your own abstractions to provide more safety guarantees... it really depends on your judgement to balance risk, reward, and goals. It's possible to write a system that does all of the checks for you but you'll sacrifice the time and energy to do so (and will still find users blowing off their feet regardless of your best efforts).
Rust is doing very cool things but it's not going to make systems programming magically easier. Someone still had to write nix and you should still understand your programs.
- cmrdporcupine 11y agoI often see these precise points in code review arguments, by developers doing something 'risky' in their code: "It's only risky if you don't know what you're doing." Half the time the same developer has made a mistake in the same code. With software being so complex, so full of human error -- almost any tool and practice that can help remedy this situation is welcome in my books.
- agentultra 11y agoProgramming is hard because thinking is hard. I think it's entirely reasonable to write security-focused software in a highly restricted language with concrete formal semantics. The problem with trivial examples is that they're often constructed to prove a point and don't represent what a real developer would write if they were to seriously consider the problem in C.
- oldmanjay 11y agoTell that to the silly mistakes I've made a career out of fixing (many of them mine!)