I'm learning c++ via this page.
In the page above and this page, it says that a modern compiler is smart enough to decide which side will have the better performance regarding the inlining of the function. The compiler is smarter than a human in most cases.
So, I thought that we could use the inline
keyword if we want to force the compiler to treat the function as inline, but that was not the case. It says that even if the function is declared as inline, the compiler is free to (and usually does) ignore the keyword.
Does this mean that the function's inline-ness is not decided by the inline
keyword, but rather the compiler has the ultimate privilege to decide it? If so, then isn't it useless for a programmer to explicitly declare a function as inline?