+ 5
Detecting an infinite loop?
Is there any way to detect an infinite loop in a function without resorting to monitoring the internal state of variables within the function?
3 Respostas
+ 5
Isn't this the Halting problem?
https://en.m.wikipedia.org/wiki/Halting_problem
It is said to be an undecidable problem. :>
+ 2
You can also - primitive but works - put a random print statement in there and look what happens.
0
You can set a timeout. then check and break the loop after specified duration.