|
![](/i/fill.gif) |
Ron Parker <ron### [at] povray org> wrote:
: No it can't. That's a famous theorem by from Computer Science, called the
: Halting Problem. It's insoluble.
It's insoluble in the general case (that is, there's no general solution
for testing the halting of an algorithm).
Sometimes, however, it can be easy:
#while(true) #end
However, it's very easy to make it more complicated.
It can be made so complicated that it's not possible for ANY logic to
deduce whether it will stop or not (just think about a short code which
tests the Fermat Theorem for all combinations of the four numbers and ends
when it finds an answer).
Theoretically it would be possible to limit the number of loops, eg.
don't allow the #while to make more than 1 million loops.
This, however, would require parsing the code as povray does.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
"The derivative of sin(2x) is cos(2x)" - Matt Giwer
Post a reply to this message
|
![](/i/fill.gif) |