News for hackers. Stuff that matters.
Re:Will It Optimize? (2010) by malisper on Saturday October 25, 2014 @05:38PM (#8509480)
> Tail-recursions are the exact equivalent of loops.

Not necessarily. In the common case of a procedure calling itself a loop does wind up being equivalent. OTOH with mutually recursive procedures (two or more procedures which call each other), there is no straightforward way to convert the tail calls into a loop.

Re:Will It Optimize? (2010) by mihai_ionic on Sunday October 26, 2014 @07:56AM (#8510846)
Is there any reason why something like the following should not work?

    while (condition)
    {
        a();
        if (!condition)
            break;
        b();
    }
Re:Will It Optimize? (2010) by malisper on Sunday October 26, 2014 @12:24PM (#8511444)
Your example assumes that you can inline the calls to a and b. If you can't (for example if one of them calls themselves) then your optimization won't work.