Why static analysis is the way to go

Walter Bright newshound2 at digitalmars.com
Fri May 29 18:25:20 UTC 2026


On 5/28/2026 5:25 PM, H. S. Teoh wrote:
> They're essentially thinly veiled disguises of pointer
> bumping, no different from having to write a thousand for-loops and
> manually bumping the loop counter (and suffering from tons of off-by-1
> errors).

Reminds me of this C loop:

```C
#include <stdbool.h>
#include <stdio.h>

typedef long T;

bool find(T *array, size_t dim, T t) {
   int i;
   for (i = 0; i <= dim; i++);
   {
     int v = array[i];
     if (v == t)
         return true;
   }
}
```

which has 5 disastrous bugs in it.


More information about the Digitalmars-d mailing list