Boost logo

Boost Users :

Subject: Re: [Boost-users] Inline functions in boost/utility
From: Niels Dekker - mail address until 2010-10-10 (niels_address_until_2010-10-10_at_[hidden])
Date: 2009-02-10 11:59:10


Timenkov Yuri wrote:
>> Looking through assembly code of simple test produced by gcc with
>> optimization, I've noticed that free functions in
>> utility/value_init.hpp (get and set) are not declared as inline,
>> though its body consist only of prologue and epilogue.
>>
>> Is there any reason for this or just a bug?

Sorry, I don't really get it. First of all, utility/value_init.hpp
doesn't have a "set". Do you mean "swap"? But secondly it's really up
to the compiler whether or not those functions are inlined. An "inline"
keyword would only be a hint to the compiler to do so, in this case.
But as value_init.hpp provides the complete definitions of the function
templates, it shouldn't be hard for the compiler to apply inlining. Are
you saying that gcc would /only/ inline those functions, when they are
declared as inline?

Kind regards,

--
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net