I'm a bit surprised. I thought the answer would be that in general you
didn't *ask* for inlining (with the inline keyword, or by defining the
member function in-class). The idea being that one wouldn't waste time
writing code/making a request unless there was a reason (profiling)
for doing so.
No. This was some fifteen years ago, the program was very close
to the limits of available memory, and code bloat was a serious
issue.
Today, of course, the situation is a bit different, and I doubt
that the rules would be quite so rigorous.
And of course there's in general the fact that, request or not, the
compiler may pretty much inline whatever it wants.
In theory, at least. In practice, 15 years ago, if the code for
a function wasn't present in the translation unit, that function
wouldn't be inlined.
Today, of course, and to a large degree, even back then, the
main reason for avoiding inlining---even to the point of
providing versions which do exactly what the compiler does, is
to reduce compiler dependencies. No one really cares whether a
function is inlined or not, but you don't want to have to
recompile all of the client code just because some minor
implementation detail has changed. And this still leads to
defining functions which the compiler would otherwise declare,
so that you can add additional behavior later without
recompiling the world. This obviously doesn't apply, however,
to "classes" that are just agglomerations of data, and given
compile times on modern machines, it likely doesn't apply to
small, or even medium size projects. (Although on most projects
I work on, "compile times" are conditionned by network speeds,
and not CPU speeds. And while there's been some improuvement
there, it is far from the same order of magnitude as that of
CPUs.)
Yep. It looks like premature optimization to me. But, as you say, it's
an old guideline.
And one that developped because we were having serious problems
with code bloat. (I don't know if it helped any, of course. I
rather suspect that the problems with code bloat were
elsewhere

.)