Suppose we have below code:
inline void DoSome()
{
cout << "do some" << endl;
}
int main()
{
void (*pDoSome)() = DoSome;
DoSome(); // one
pDoSome(); // two
}
For above code we have three possible scenarios:
Now I want know which of the above scenarios is true?
inline
is a hint to the compiler, but it is not an obligation. It is up to the compiler to decide if a function declared as inline
will actually be inlined and thus any of the two calls may or may not be inlined.