On 11/2/2014 12:06 AM, "Ola Fosheim Grøstad"
<[email protected]>" wrote:
On Sunday, 2 November 2014 at 06:39:14 UTC, Walter Bright wrote:
This is not a solution. C has successfully resisted all attempts to add bounds
checking.
That was a student project, but the paper presented an overview of techniques
which is why I linked to it.
Sorry, I had presumed you intended the links to be practical, workable
solutions.
A realistic solution is probably at 10-50 times
slower on regular hardware and is suitable for debugging, and you can probably
improve it a lot using global semantic analysis.
To quote the Nasa paper's conclusion:
«We have shown in this paper that the array bound checking of large C programs
can be performed with a high level of precision (around 80%) in nearly the same
time as compilation. The key to achieve this result is the specialization of the
analysis towards a particular family of software.»
So no, C has not resisted all attempts at adding bounds checking.
People are doing it.
10 to 50 times slower is not a solution. If your app can stand such a
degradation, it would be better off written in Python. If there was a practical
solution for C, it likely would have been incorporated into clang and gcc.