On 3/18/2015 5:45 AM, CraigDillabaugh wrote:
You said that "Unfortunately" this thinking is going out of style "for good
reasons". I am confused (sorry, I am at work, and didn't have time to watch
the 1+ hour video you linked to - maybe some clues were there)!
Consider this C code:
#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;
}
}
There are several bugs in it. I've showed this to probably over 1000
programmers, and nobody found all the bugs in it (they are obvious once pointed
out). It is not easy to write bug free loop code, and find() is a trivial function.