Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: a question about the value of checking bounds (OT)

Author: Matt Taylor

Date: 02:51:41 01/22/03

Go up one level in this thread


On January 21, 2003 at 14:37:52, Dieter Buerssner wrote:

>On January 21, 2003 at 12:08:08, Uri Blass wrote:
>
>>I finished the time of my evaluation of checking bounds.
>>
>>It is expensive to buy it and before deciding if to buy it I want to know about
>>the value of the alternatives.
>>
>>How many programmers use it?
>
>I don't, at the moment. When I have time, I will build a gcc version with
>bounds checking built in. For allocated memory, libary solutions may work very
>well. For "normal" array, to me it seems, that compiler support for bounds
>checking is best. Actually, I am puzzled, that compiler vendors don't do it.
>Over ten years ago, I worked with Fortran under VMS. The DEC Fortran compiler
>had a switch (VMS-language, if I recall correctly) /DEBUG=ALL, which included
>bounds checking. With "modern" C-compilers, it seems not easily available. No
>doubt, it might have very high costs at runtime. Many programmers won't care.
>
>Regrads.
>Dieter

Why does it have to be done at runtime? Ada and Pascal can do some
bounds-checking at compile-time. I have heard that C# can -guarantee- that code
won't mess around with bad memory. I think the same techniques can be applied
toward C/C++, and I am also suprised that it is not very popular. Compile-time
bounds-checking comes as free as constant folding.

It may require changing the build process, but I find that less annoying than
letting bugs go uncaught because I did not exercise a particular path in the
program.

-Matt



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.