Boost logo

Boost :

Subject: Re: [boost] inline specifier within in class definition
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2009-05-04 08:27:03

Mateusz Loskot wrote:
> However, I've not found clear answer in that thread.

Strange. I assume your question is "Why are some static member functions defined within class definitions specified with inline keyword?" and the answer is "The only reasons for this is to try to influence the inlining behavior of the compiler." (+copy&paste from existing code...)

This is what I call a clear answer.

The questions

1) Whether it is necessary to try to influence the inlining behavior of the compiler, and
2) Whether the inline keyword actually does influence the inlining behavior of the compiler

may be related questions, but the fact the some of us have a hard time believing the answers to these questions doesn't make the answer to the initial question less clear.

> Looks like it's a kind of mix of historical relict
> of old pre-standard habits

I can't remember any reference to pre-standard habits in the answers in that thread. You probably mean compilers with poor optimization capabilities, but "pre-standard" does say something completely different.

> with disbelief today compilers are able choose right

In my impression, this question wasn't settled in that thread. However, the supporters of the "you sometimes have to help the compiler" opinion were actually more willing to present experimental evidence than the people who thought this was superstition.

The problem of this is that you don't end up with a definite answer when to use the inline keyword (I guess you were hoping for "never use the inline keyword unless explicitly required"), and that the mere presence of some (superfluous?) inline keywords will make more superfluous inline keywords appear by "copy&paste".


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