Re: How to develop a random number generation device



On Wed, 19 Sep 2007 21:03:38 +0000, Rich Grise wrote:

Static analysis tools can only find some bugs. Some code has to be
stepped through to see if it ever gets stuck or goes into a loop. I'm
thinking of things like:

while (X > 1) do
if (X is even) X = X/2;
else X = 3 * X + 1;

It is really hard to see whether for some values of X this sticks in a
loop or not.

It didn't take me any time at all to see that this has no bounds checking;
what happens if someone passes X=1.42857 to it?

In a statically-typed language, that isn't an option (unless you're
seriously suggesting that X would be declared as a floating-point variable).

This little example-oid was clearly written by one of those lame
programmer-wannabees who keeps sniveling "All Software Has Bugs And
There's Nothing You Can Do About It!!!" as an excuse for his
incompetence/laziness.

No, it's a simple example of something which can't easily be proven to
terminate. Most static analysis tools don't even try to address
non-termination.

Pointing out that some bugs can't be eliminated by static analysis isn't
the same thing as suggesting that they can't be caught at all.

Having said that, most of the bugs which occur in the wild are of a kind
which could easily be caught using better tools. More powerful type
systems (e.g. those typically found in functional languages) would go a
long way, as would design-by-contract (as in Eiffel).


.



Relevant Pages


Loading