Comment by guappa

2 days ago

recursion on embedded devices is terrible… you have very little memory.

It's more about having an easily verifiable limit on the size of the call stack. You can still use recursion in algorithms with this rule. It just forces you to allocate a separate stack to manage it.

  • Separate stack still uses memory, you need to prove the bounds.

    • Yes. My point is that: 1. "No cycles in call graph" is not about memory usage but about having an easily provable limit on call stack and 2. "No cycles in call graph" is not about banning recursion.

      I agree that the call stack limit is much more important in environments with tight memory but the rule is about the stack limit, not memory in general.

      Edit: for 2. I obviously mean recursion as the class of algorithms, not as the property of the functions used to implement it.