Non-Transparent Memory Safety
blog.regehr.org
blog.regehr.org
int lookup (int *COUNT(array.length) array, int index) {
return array[index];
}
Shouldn't there be an assert(index < array.length) in there too? Looks a bit half baked to me otherwise.Where has the Deputy material gone?
http://msdn.microsoft.com/en-us/library/windows/desktop/ms63...
where the window system makes a callback including a pointer lpCreateParams whose type depends on what you did earlier while creating a window. Deputy can't possibly know whether you're using that pointer in a typesafe way, it just has to believe every TRUSTED cast you make, any of which could be wrong (and some surely will).
If you want to say that's bad API design, I wouldn't argue, but I found that kind of thing to be normal in C, and the massive reinvestment in getting rid of all code like that might as well include switching to a language that doesn't create these problems.
There are multiple orders of magnitude difference in the effort needed to completely rewrite an entire API implementation in this other language vs. adding some annotations to the existing code. Sure it can't catch some really dirty type abuse like that, but it would let you identify when it is happening so you can prioritize your focus accordingly.