> But the compiler does not know that fstrcmp is called millions of time and
> that this piece of code needs to be optimized for speed rather than for space.
If doing profile-directed optimization, it does know. In this case, it
will even inline five or six recursive calls, as in
if (n >= 2)
{
n1 = n - 1;
if (n1 >= 2)
{
n2 = n1 - 1;
nn1 = n * n1;
if (n2 >= 2)
return nn1 * n2 * fact (n2 - 1);
else
return nn1;
}
else
return n;
}
else
return 1;
(which is not the case of fstrcmp, but just to leet you know).
> Does GCC meanwhile have a heuristic that forces inlining of a 'static'
> function that is only used once in the compilation unit?
Yes, though I think it is limited by the growth in stack usage.
Paolo