Suppose we fave a following header file:
Header1.h
#include "Header2.h"
class A
{
public:
void Function();
}
inline void A::Function()
{
// Code ...
OtherFunction(); // Function from Header2.h
// Code ...
}
If a compiler actually chooses to inline the Function
what would happen with the call to OtherFunction
:
- If
OtherFunction
definition was available for current translation unit, could it also possibly be inlined within the body ofFunction
? (Basically are nested inlines available?) - If
OtherFunction
definition was not available for current translation unit, will it remain a simple function call, while the code around it gets inlined? (In a situation where compiler chose to inlineFunction
)