These instructions indicate to the compiler that you want the function to be linearized, i.e., that instead of calling it its code is placed where it had a call saving a few bytes and processing since it is no longer necessary to have the function header and footer and in some cases no longer need to copy argument data to parameter.
inline
is standard of C++ and is a hint for the compiler to consider doing this optimization there. Not that he does not do if he does not have this keyword, he can do if he thinks it pays to optimize, even without anything written. Instructing like this can increase the chance, but depends on the compiler, nothing guarantees. Naga ensures that optimization is done, the compiler can recur if he doesn’t think it pays.
__inline
is the same but is an extension of the Microsoft compiler. The exact way the compiler treats depends only on it.
__forceinline
It’s just an indication that you really want the optimization to be done, so the chance is grid to occur, but it’s also not guaranteed. If it is too clearly bad the compiler does not.
Being able to use large functions can, but is not recommended and is likely to ignore the compiler. If you don’t know if it’s really useful, don’t use it, it’s a very advanced feature.
Documentation.
Related:
Remembering that
__forceinline
and__inline
are specific to Microsoft compilers and are not part of the standardC98
. Only the keywordinline
is part of the patternC98
andC++
.– Lacobus