|
|
"scott" <sco### [at] scottcom> wrote:
> I'm not saying it's possible to detect whether any program will stop or not.
> I'm saying that in *some* cases you can relatively easily detect that it
> won't stop without changing the functionality.
I'm definitely repeating myself here: Those easy cases would come packaged with
too many not-so-easy special cases.
Sure you can detect a simple
#while (i < N)
//#declare i=...
#end
as being an infinite loop, but that's an absolutely trivial case; as soon as you
go from there to
#while (i < N)
...
//#declare i=...
...
#end
then if you don't find a "#declare i=...", you *must* examine the "..."
thoroughly before you can conclude that the user really forgot it.
Of course, if you *do* find a "#declare i=..." in there, you can tell for sure
the user did *not* forget it; but that doesn't get us any further.
The bottom line is that a potentially-infite-loop detector would be a quite
complex piece of code, even if it were just to catch some standard cases. There
would be much easier and more useful remedies for the forgotten-increment
ailment.
Post a reply to this message
|
|