3 ms·
I never understood this one. I mean obviously a kind compiler should warn you against using while true { } and while i < 5 { i—-; } but in general,
by tomp 6y ago
I never understood this one. I mean obviously a kind compiler should warn you against using
while true { }
and
while i < 5 { i—-; }
but in general, I don’t find distinction between “this infinite loop terminates” (e.g. an event loop) and “this code obviously terminates but not in the lifetime of this universe” (e.g. computing Ackermann(5)) to be that useful.
- creata 6y agoIt's primarily useful for theorem proving, where a nonterminating argument corresponds to circular or otherwise unfounded reasoning. It's also useful because, in practice, we don't accidentally write code that "obviously terminates but not in the lifetime of this universe" as often as we accidentally write nonterminating code, so a lot of mistakes can still be caught by termination checking.