Recursion Optimization
Kevin Atkinson
kevinatk@home.com
Mon Aug 16 00:37:00 GMT 1999
Does gcc optimize in any way to minimize the cost of recursive functions
calls. In particular:
ONE:
Does gcc optimize tail recursive functions into simple loops?
TWO:
In a function call like this:
int sum(int i, int stop) {
if (i == stop) return i;
else return sum(i+1, stop) + i;
}
Will gcc recognize that the value of the second parameter never changes
so that it can avoid allocating multiple copies of it on the stack.
--
Kevin Atkinson
kevinatk@home.com
http://metalab.unc.edu/kevina/
More information about the Gcc
mailing list