Warp wrote:
> Whether the compiler will inline a function (from which it has the
> implementation at that point) is unspecified and completely up to the
> compiler. The 'inline' keyword doesn't really matter in this.
Right. So adding an inline function to a header file means that the
compiler *could* inline it across compilation units (which would
otherwise be impossible), but ultimately it's up to the compiler to
decide what it will or won't inline?
I can certainly see why the standard doesn't mandate anything either
way. Do you happen to know the "typical" behaviour of any well-known C++
compilers? (Presumably it varies depending on the optimisation level you
select...)
> (Btw, template functions are implicitly 'inline', so the keyword doesn't
> have to be used with them.)
That makes sense.
Post a reply to this message
|