Boost logo

Boost :

Subject: Re: [boost] inline specifier within in class definition
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2009-05-05 15:50:32

Simonson, Lucanus J wrote:
> Mateusz Loskot wrote:
>> Thomas Klimpel wrote:
>>> 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.
>> I understand it but isn't enough to define such member function
>> within class definition? It should be, according to what the C++
>> standard states.
> If, by some strange coincidence, you happen to be implementing a
> non-template class and leave out the inline keyword when defining a
> static member function in the header file as part of the class
> definition, or any other kind of function, for that matter, you end
> up with a multiple function definition link-time error when the
> header is included in multiple execution units.

What you are saying here stays in contradiction with section 2 of
chapter "9.3 Member functions" as well as with section 3 of
chapter "7.1.2 Function specifiers" in the C++ standard.

> Specifying the inline keyword forces the compiler to make the
> function signature a weak symbol and eliminates the link time error.
> [...]


Best regards,

Mateusz Loskot,
Charter Member of OSGeo,

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