Find limit of recursion: Difference between revisions

Line 113:
 
Through execution (with Mono), another user has reached 697186.
=={{header|D}}==
<lang d>import std.c.stdio: printf;
 
void recurse(uint i=0) {
printf("%d ", i);
recurse(i + 1);
}
 
void main() {
recurse();
}</lang>
With the DMD compiler, using default compilation arguments, the stack overflows at 51_780.
 
Using -O compilation argument DMD performs tail call optimization, and the stack doesn't overflow.
 
DMD also allows to increase the stack size. Using for example -L/STACK:1500000000 the stack overflows at 75_002_026.
 
=={{header|E}}==
Anonymous user