3 ms·
You need to consider not just the memory access itself, but the consequences of preventing it. With a compile time check, there's a development cost but absolu
by yaantc 4y ago
You need to consider not just the memory access itself, but the consequences of preventing it.
With a compile time check, there's a development cost but absolutely no runtime consequence.
With a dynamic check, sure the memory access is detected and blocked. But if you stop there the application crashes, which may be completely unacceptable. In an embedded system such a crash may be as bad as the incorrect access itself.
More generally, the issue is not so much the incorrect access than its possible adverse consequences. With a compile time check, there are no runtime consequences. With a runtime check, there are still runtime consequences: either the impact of an application crash, or the extra error handling code and behavior to deal with the detected wrong access and mitigate it at runtime. Whether such consequences are acceptable or not depends on the context, but it's there and do make a difference with a compile time or static analysis check.
- foldr 4y ago>In an embedded system such a crash may be as bad as the incorrect access itself. I don't agree on this point. An incorrect access on an embedded system has the potential to cause all kinds of horribly subtle bugs involving memory corruption. A simple crash is generally much better.
- yaantc 4y agoPossibly, but I won't argue about hypothetical kinds of bad when a runtime issue happen ;) The point I tried to make was that you want neither for such use cases. Hence compile time verification (type base, static analysis, proofs for the most critical).