[progress Communities] [progress Openedge Abl] Forum Post: Recursive Function Versus...

Status
Not open for further replies.
O

oedev

Guest
Currently in the process of trying to resolve an issue around a recursive function call in our code generating a stack overflow and core dump. In my investigation, it appears the converting the recursive function to a procedure fixes our issue. I can easily re-produce via an example to demonstrate a recursive function and procedure failing at different points with different errors. Recursive function fails at 538 iterations with a core dump, recursive procedure at 19983 with error "SYSTEM ERROR: bfblst -- Too many block levels. (1)" Starting my client with -s 200000 -nb 2000 as start-up parameters. So these questions are; 1 - why the different points of failure and different errors 2 - Changing a function to a procedure and vice versa: can there be any side-effects, e.g. record scope etc. Recursive procedure example; OUTPUT TO VALUE("c:\temp\recursive-test-proc-output.txt") NO-ECHO. PROCEDURE test: DEFINE INPUT PARAMETER Y AS INT. PUT UNFORMATTED Y SKIP. Y = Y + 1. RUN test(Y). END PROCEDURE. RUN test(0). Recursive function example; OUTPUT TO VALUE("c:\temp\recursive-test-func-output.txt") NO-ECHO. FUNCTION test RETURNS LOGICAL (INPUT Y AS INT) : PUT UNFORMATTED Y SKIP. Y = Y + 1. test(Y). END FUNCTION. test(0).

Continue reading...
 
Status
Not open for further replies.
Top