To view parent comment, click here.
To read all comments associated with this story, please click here.
Err well that is called Formal Specification.
http://en.wikipedia.org/wiki/Formal_methods
In some ways it is similar to unit testing except much more rigorous.
Edited 2012-10-24 10:20 UTC
hackus,
"Reminds me of the crap research I had to sit through where someone was trying to convince everyone you can mathematically prove a program and make it bug free.
What a gigantic load of crap."
Not at all, if a program has a limited number of states, and each one of those states can be proven to do what is intended under all possible conditions, then you've got yourself a bug free program.
There's one huge caveat, a program has no choice but to assume its foundation (language and operating system) is bug free and deterministic. Alas, sometimes operating systems do break promises, in which case even "bug free" programs can behave unexpectedly.
Here's an example:
void*a=malloc(1000000);
if (a==null) exit(1); // exit predictably rather than crash
memset(a,0,1000000); // segfault?
This code can crash under linux because linux will allocate virtual memory addresses without ensuring there are sufficient physical/virtual memory pages to back them. To my knowledge, linux is fairly unique among unix implementations to fault during memory access rather than fail gracefully at malloc.
http://linuxdevcenter.com/pub/a/linux/2006/11/30/linux-out-of-memor...
It's possible to use unconventional methods to preallocate real memory from the heap, but there's the whole issue of OS memory overcommitting. When this happens, two instances of a process can use shared copy-on-write memory, but the OS has only reserved enough ram for one copy. In the event that one of the processes has to change a shared page, it is necessary to clone the page, but that can fail.
char a[]="This is a very long non-const test string..."; // global variable might initially be loaded into shared memory pages.
void f() {
a[0]++; // segfault?
}
I guess I kind of proved your point for you
I wanted to emphasise that mathematical correct programming is possible, but it requires similar mathematical correctness from the OS/language in order to be effectively correct. At the very extreme, one might argue that our hardware itself is probabilistic in nature, but that still doesn't dismiss the mathematical correctness of a *software* system in principal.





Member since:
2005-08-18
I see you havent heard about Kaspersky