D - Deep recursion problem
- Lars Ivar Igesund (12/12) Nov 12 2003 When doing some testing with my ddepcheck app, I found
- Walter (3/15) Nov 12 2003 D shouldn't have any different recursion issues than C or C++.
- Matthew Wilson (16/28) Nov 12 2003 I just compiled and ran the following code, and it descended to a depth ...
When doing some testing with my ddepcheck app, I found out that to deep recursion isn't handled perfectly by D/dmd. If the recursion is infinite, it crashes very quickly. If I try to limit it, I get an Acces Violation at a certain depth (18 with an optimized build, deeper when not optimized). The quick crash result in no message whatsoever, but I would have expected an Out of Memory error. The access violation don't say anything about what is violated or where. Better diagnostic messages would have been helpful. (The problems helped me make a more robust recursive app, btw. The recursion can no longer be infinite.) Lars Ivar Igesund
Nov 12 2003
D shouldn't have any different recursion issues than C or C++. "Lars Ivar Igesund" <larsivi stud.ntnu.no> wrote in message news:bost27$1mcg$1 digitaldaemon.com...When doing some testing with my ddepcheck app, I found out that to deep recursion isn't handled perfectly by D/dmd. If the recursion is infinite, it crashes very quickly. If I try to limit it, I get an Acces Violation at a certain depth (18 with an optimized build, deeper when not optimized). The quick crash result in no message whatsoever, but I would have expected an Out of Memory error. The access violation don't say anything about what is violated or where. Better diagnostic messages would have been helpful. (The problems helped me make a more robust recursive app, btw. The recursion can no longer be infinite.) Lars Ivar Igesund
Nov 12 2003
I just compiled and ran the following code, and it descended to a depth of 51728 before reporting "Error: Access Violation" import std.c.stdio; void fn(int i) { printf("%d\n", i); fn(1 + i); } int main() { fn(0); return 0; } Hope that helps "Lars Ivar Igesund" <larsivi stud.ntnu.no> wrote in message news:bost27$1mcg$1 digitaldaemon.com...When doing some testing with my ddepcheck app, I found out that to deep recursion isn't handled perfectly by D/dmd. If the recursion is infinite, it crashes very quickly. If I try to limit it, I get an Acces Violation at a certain depth (18 with an optimized build, deeper when not optimized). The quick crash result in no message whatsoever, but I would have expected an Out of Memory error. The access violation don't say anything about what is violated or where. Better diagnostic messages would have been helpful. (The problems helped me make a more robust recursive app, btw. The recursion can no longer be infinite.) Lars Ivar Igesund
Nov 12 2003