Function inlining is when the function called is directly substituted in the calling code. This avoids the overhead of setting up the call stack, managing any relevant pointers that need to be tracked (instruction pointers, stack pointer, etc.), and seems to be generally faster than actually calling a function.
So, why isn't this done automatically for all functions, given the seemingly many benefits. The compiler may even ignore the inline
keyword in C/C++. Are there any general or specific disadvantages to always inlining functions?
inline
goes both ways - within a translation unit, the compiler may freely inline any invocation based on its own judgement $\endgroup$