Re: inline request and compiler rejection
Pallav singh wrote:
Q when is inline request to compiler rejected?
1. Function length is large
This is pure speculation. What's "large"? How do you *define* "large"?
2. Recursive function call
is there any other situation when inline request is rejected by
Compiler in C++ ??
There is no requirement in the Standard for the compiler to *reject*
'inline'. The compiler is *explicitly allowed* not to inline a function
that is declared 'inline' or is implicitly 'inline'. The compiler is
required for an exported function template declared 'inline' not to be
exported.
So, your question should probably be, "is there any [other] situation in
which the compiler *cannot* satisfy the 'inline' request?"
Well, virtual functions called polymorphically have to have a body since
[in all current implementations] pointers to those functions are placed
in the vtable. A function whose address is taken will most likely have
a body. But those situations do not necessarily dictate that such a
function is *never* inlined. FWIW, it can just as well be inlined and
used as an inline function *along* with having a body somewhere.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask