Leveraging the elegance of recursion:
C++ Tail Recursion Using 64-bit variables
by Giovanni Campo
From the article:
Main disadvantage of Recursion in imperative languages is the fact that not always is possible to have tail calls, which means an allocation of the function address (and relative variables, like structs for instance) onto the stack at each call. For deep recursive function this can cause a stack-overflow exception because of a limit to the maximum size of the stack, which is typically less than the size of RAM by quite a few orders of magnitude.
Add a Comment
Comments are closed.