今天我的一位同事在微信群里发了一张图片,勾起了我的好奇心:不同编程语言支持的函数递归调用的最大嵌套层数是?
private static void recur(int i){ System.out.println("Stack level: " + i); recur(++i); }
测试结果:8644
Chrome版本:
Version 70.0.3538.102 (Official Build) (64-bit)
function a(i){ console.log("stack level: " + i) a(i+1); } a(0);
测试结果:11412
nodejs version: v8.11.3
测试结果:11213
版本:
测试结果:3947556
data: lv_temp type int4. form recur using iv type int4. sy-index = iv. lv_temp = iv + 1. perform recur using lv_temp . endform. START-OF-SELECTION. perform recur using 0.
实际上是out-of-memory错误。
测试结果:12258206
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24475491/viewspace-2220727/,如需转载,请注明出处,否则将追究法律责任。