[C++-sig] function template instantiation

Sven Marnach sven at marnach.net
Fri Mar 30 00:59:27 CEST 2012


(answering off-list)

Kyle Cronan schrieb am Thu, 29. Mar 2012, um 16:14:04 -0500:
> ... but I have some methods I want to ensure are not inlined ...

Note that this is impossible.  The compiler is free to inline *any*
function.  If the address of a function is taken, the compiler must
emit code for a non-inlined version, but this is independent from
whether the function is defined inline or not.  And even if a
non-inlined version is present, the compiler still can inline other
calls.  Bottom line: it doesn't matter whether you define functions in
the header or not, at least as far as inlining in concerned.

Cheers,
    Sven


More information about the Cplusplus-sig mailing list