4 ms·
A lot of point-missing here about the example C program. Maybe everyone else in the world is a perfect C coder who never makes a mistake, but I've found every s
by shabbyrobe 9y ago
A lot of point-missing here about the example C program. Maybe everyone else in the world is a perfect C coder who never makes a mistake, but I've found every single one of those mistakes in my own code at one point or another (though of course, not at quite the same density). The point is that they're easy to make, and though there is tooling, it's extremely cumbersome and imperfect.
Worse, over time as a codebase gets more complicated and older - and only if you're one of the few lucky enough to start with C code that isn't an unholy, inconsistent no-warnings disaster-mess slop bucket of horror - some of those warnings have a nasty habit of getting disabled so some middle manager can expedite some unreasonable commitment out a door to tick a box.
Call me a masochist but I enjoy writing C, particularly with valgrind, *san, afl, et al at my back. But I felt the point was well made by the author and I find it hard not to feel like a world where these problems simply didn't exist at all might be a bit nicer
- 2trill2spill 9y ago> The point is that they're easy to make, and though there is tooling, it's extremely cumbersome and imperfect. What's hard about adding -fsanitize=address or -Weverything to your Makefile? Or running a program under Valgrind, or using the clang static analyzer or coverity? Using AFL can be a little cumbersome but still not that hard.
- seba_dos1 9y agoDepending on what you're doing, AddressSanitizer might not be available for you to use, as there are plenty of ASAN-incompatible constructs that may be used by libraries your application depends on. (it's worth looking at other sanitizers anyway, it seems not everyone is aware of their existence after all; if you can't put C away they're really great tools for retaining your sanity :))
- irundebian 9y agoIn contrast to Rust's language design, -fsanitize and -Weverything and static source code analyzer can't give guarantees over memory safety. Considering that your main activity in your Github profile is concentrated on JavaScript, I wouldn't be so cheeky. Feel free to post your self-written applications (no fuzzers or similar with uninteresting attack surfaces) written in C for open review.
- Peaker 9y agoYou can't use -Weverything on a real project. It's full of noise. You can enable many others though, but -Weverything is virtually useless.