3 ms·
One of the major difficulties of doing static analysis for systems programming languages like C is that the semantics are defined by the whole system, not just
by mcguire 9y ago
One of the major difficulties of doing static analysis for systems programming languages like C is that the semantics are defined by the whole system, not just the language. Writing a value to an obscure location not otherwise mentioned in your program is how you turn on that led. No, it's not portable. Yes, it's necessary. And that's ok.
Better tools are needed.(TM)
Check out "Some were meant for C" for an interesting read. http://www.cl.cam.ac.uk/~srk31/#onward17 http://www.cl.cam.ac.uk/~srk31/#onward17
- MaxBarraclough 9y ago> No, it's not portable. Yes, it's necessary. And that's ok. Indeed, and it may be necessary to have an analysis tool skip over that code, but it applies to only a tiny minority of C code. Interesting skim-read, that paper. I agree with the author's lamentation that we so often pretend there's nothing we can do about C's safety issues. Even configuring GCC to check all dereferences for NULL, strikes many people as unusually rigorous. Dev+debug builds in particular should have as many runtime checks as possible, but for no obvious good reason, that's just not how we do things.