Ian said:
I'm not sure if you are being obtuse, an arse or a troll.
All I did was compile the code *you posted* with the *same compiler* you
used and post the results. I made no mention of any corner case. If
you make another attempt at reading the few simple words that appear to
be causing you trouble, you'll see I contradicted the assumption the
function were inlined. Just to help you out, I'll quote them again:
"The calls are still made, the function bodies are optimised."
There, do you get it now?
Ian,
I don't take you for a moron, but you aren't adding any confidence to that
assumption. Here's why.
Read the thread, and try to understand where and why I've posted the example
you've referred to. Here's a hint: if someone makes a baseless assertion
regarding how most likely something doesn't affect performance and a trivial
example is enough to show a significant performance penalty, even when
squeezing some implementation-dependent optimization tricks from a specific
compiler, as even you've showed with the tests you did yourself, then what
can you say about that baseless assertion?
Then, please try not to forget that every time you talk about any specific
compiler and any specific optimization trick it is able to pull on specific
types of functions being called in specific ways, you are talking about
corner cases which are implementation dependent. You simply can't
extrapolate the results of your corner cases to C++, as defined in the
standard. If you believe you can then simply think about this: why does the
C++ standard specifies that when a function is declared with the inline
specifier, all compilers are free to ignore that hint? In other words, why
are you expecting that all C++ compilers inline functions which aren't
declared to be inline if it isn't even possible to expect that any compiler
will inline a function specifically declared to be inlined?
Finally, if you feel compelled to throw a string of insults at others you
disagree with, maybe it's time to spend a moment or to to think about what
you are doing and what you are saying.
Rui Maciel