[m-dev.] question about infinite recursion warnings

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Apr 24 11:31:20 AEST 2019



On Wed, 24 Apr 2019 11:16:22 +1000, Michael Day <mikeday at yeslogic.com> wrote:

> > How about --warn-suspicious-infinite-recursion?
> 
> Implies the existence of suspicious non-infinite recursion, or possibly 
> non-suspicious infinite recursion :)

Good point, but the first actually exists, and maybe the second
does as well.

For suspicious non-infinite recursion, consider this:

p([X | Xs], A0, B0, Out) :-
   update_a(X, A0, A1),
   update_b(X, B0, B1),
   p(Xs, B1, A1, Out).

The suspicion comes from the swapping of the A and B args;
nothing to do with infinite loops.

As for the second, in realtime systems and operating systems,
infinite recursion is the *intended* behavior (in the absence
of an explicit shutdown command, that is). The correctness
proofs of such systems require a proof of *non*-termination.
Whether such intended infinite recursive calls could be called
suspicious is in the eye of the beholder.

Zoltan.


More information about the developers mailing list