Boost logo

Ublas :

Subject: Re: [ublas] Is there a special reason to use inline before template functions?
From: manning.jesse_at_[hidden]
Date: 2008-12-08 09:00:29


The inline keyword is only a hint to the compiler that you think this
method would be more efficient inlined than a standard function call. The
compiler is free to ignore any and all of your inline hints and it is also
free to inline anything when it thinks it will be more efficient. Nowadays
with compiler optimizations turned on it is very good at figuring out what
to inline and what not to. This is just a guess, but perhaps previous
compiler versions were not as good at figuring out what to inline when
heavy template use and metaprogramming was being used.

On Dec 8, 2008 4:10am, Gunter Winkler <guwi17_at_[hidden]> wrote:
> Am Montag, 8. Dezember 2008 00:48 schrieb Thomas Klimpel:
>
>
>
> > Most libs only prepend inline before template functions, but ublas
>
> > prepends nearly every member function with the macro
>
> > "BOOST_UBLAS_INLINE", which expands to "inline". Is there a reason
>
> > why ublas uses this macro?
>
>
>
> I think this is only used for historical reasons because it existed
>
> since I started to use ublas. At this time it mad a big difference to
>
> compilers when inline was given. Maybe this is now obsolete - however
>
> it should not hurt.
>
>
>
> Do you have any concerns that too many "inlines" might reduce
>
> performance? If you identify such methods then we can simply remove the
>
> inline qualifier.
>
>
>
> mfg
>
> Gunter
>
>
>
>
>