A simple recursive function that computes the factorial of an integer:
1 2 3 4 5 6 7 8 9
int a (int depth)
{
return depth*a(depth-1);
}
void b ()
{
std::cout << a(10);
}
Clearly, the first call of a cannot be inlined because it is recursive. However, the second call of a is not recursive. Is the second call inlined? Can one function be sometimes inlined and sometimes not? I'm using gcc 4.6.2.