"> How judicious ought one be when inlining small methods.
That's simple: you never inline anything until the profiler says
you must.
I once read that in general, most compiles will only inline 'one'
level.
Not the ones I use. G++ (the only one I've verified) handles 40
some levels if you inline a recursive function.
In general, any limits will be more because of the complexity of
the program to begin with. (Some older compilers wouldn't
inline anything with a switch statement, of course.)
On the other hand, most (but not all) compilers require the
definition of the function to be present in the compilation unit
in order to inline. Which, of course, introduces significant
compiler dependencies, and has a significant negative effect on
programmer productivity.
Most coding guidelines I've seen ban inline functions
completely, for this reason."
************* (I hate it when OE refuses to quote correctly!) ***********
Which begs the question: why is there no 'outline' keyword? Combined with
code-folding editors, it would make it easier to organize some class header
that have just a few or one outline function(s) (one file instead of 2 to
manage). Most compilers do seem to have an "outline all inline functions"
switch though. A curious experiment would be "inline all outline functions"
too. I agree that in general, inlining functions is bad because it increases
dependencies. A lot of code starts out that way though during development
until it evolves to the point where the major functions are moved to a .cpp
file.
John