Thanks for proving Bernstein right
Thanks for proving Bernstein right
Posted Nov 4, 2007 15:43 UTC (Sun) by jordanb (guest, #45668)In reply to: Thanks for proving Bernstein right by i3839
Parent article: Daniel Bernstein: ten years of qmail security
History has demonstrated that the weakly-typed pointer system in C *has* been the source of many, many security bugs. I can't speak to Java because I don't know much about it but I *can* say that many modern languages, probably beginning with modula2, have paid a lot of attention to the ways in which programmers tend to make mistakes and structure the language to either eliminate them or at least be able to recognize that a bug has been encountered. Not allowing pointers/access types to address parts of the memory that haven't been explicitly allocated as their dereference type is an example of the former. Raising an exception if an integer overflows rather than just rolling over to zero and continuing like nothing happened is an example of the latter. I, personally, am becoming a fan of Ada. It combines strong/safe typing and one of the most capable regimes of constraints and discriminants that I've seen with an incredible amount of static analysis, such that a surprising number of mistakes are caught at *compile* time. It's certainly true that you can write bad code in any language. But some languages don't do anything special to try to help you out. And some have some language design decisions that seem to go out of their way to cause you problems. I can say that C is the only language I use for which I really need a debugger. That says something I think. Even though it doesn't have memory pointers, another language that is not designed to help prevent bugs is PHP. Just the other day I had a bug where a function returned a boolean and I expected it to return an array. I went off and tried to use the "array" and my program failed to operate as expected -- but with no warning or error as to what the problem was. As it was it took my a half hour to track down that rather trivial thing. In any real language, it would have *told* me that the problem was that I was using a boolean type object improperly, but PHP shares C's anemic typing regime and thus is ripe for uncaught bugs.
