Quote Originally Posted by matsp View Post
I think the compiler CAN inline a function that calls another (external) function, but it will need to keep the original function too, so if the function is also large, it's likely to NOT inline it.
Whether to inline a function is decided in each compilation unit independently. I don't see why a compilation unit would ever inline and also keep the original definition. It may mark in some way the inline expansion of a function, in case it needs to change it to non inline. But the definition would be used from a compilation unit that did not inline.
For recursion, I'm pretty sure it will inline constant level recursion (where at compile-time the compiler can decide the number of recursions), but it's obviously necessary to keep the original type of function around for the "don't know how many levels of recursion".

--
Mats
But it's indirect recursion. The number of recursions is determined by the non-inline function. For example:
Code:
inline int func1(int eg){
    return func2(eg);
}

int func2(eg){
    return eg?eg*func1(eg-1):1;
}
There should be no problem inlining func1, even though the number of recursions is unknown (as long as func2 is not inline too). A call to func1 would in this case simply be a call to func2. Func2 becomes directly recursive after inlining, but it's not inline itself, so that's not a problem.