Hi folks,

a suggestion about recursive function calls (and not only that, of course).

Do you see a way for Bash to pull the emergency break before it runs out of stack here (to provide an error to the user, rather than a crash):

--------------------
f1() {
  f1
}

f1
--------------------

Currently it runs into a SEGV, where the number of recurions depends on the stack limit.

On a fast search I found no portable way, but there are ways for specific platforms, like getrusage() when stack is reported there.

--
Be conservative in what you do, be liberal in what you accept from others.
- jbp, master of the net, in RFC793


Reply via email to