Boost logo

Boost :

From: Jason Hise (chaos_at_[hidden])
Date: 2005-10-04 14:37:57

Rob Stewart wrote:

>>>>* pimpl's member functions should be inlined.
>>>>They are all trivial, so you should make them inline.
>>>Aren't templates always inlined?
>>Agreed, and besides, isn't it usually better to let the compiler decide
>>what to inline or not inline on its own unless extensive profiling shows
>>that adding the inline keyword really gives you a big performance gain?
>Does that mean you think they are always inlined?
>Many compilers don't do it at all unless you suggest it via
>"inline" or put the code in the class definition. Some will
>inline things you didn't suggest should be.
>In this case, the functions are nothing but forwarding
>functions. Why would you want to pay for an extra function call
>on those compilers that won't do anything unless you ask for it?
Based on reading item 25 in Herb Sutter's "Exceptional C++ Style", I was
under the impression that a decent compiler would easily inline calls
like this on its own, without any suggestions from the programmer. But
then I haven't directly done any profiling myself to compare how
differently modern compilers behave when explicitly provided with the
inline keyword, so I could well just be under a mistaken impression.


Boost list run by bdawes at, gregod at, cpdaniel at, john at