I am wondering if anyone knows the logic which C++ compilers generally use to decide whether or not to inline a function at compilation (assuming inline has been requested).
Is this type of thing public knowledge?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I gave a more thorough answer in this other question.
Basically compilers have heurstics based on cost-analysis, quoting myself (does this mean I am going senile ?)
And of course, there is also partial inlining in which only part of the function is inline, typically a leading
ifguard likefoo(T* t) { if (!t) { return; } <many many things> }.