An inline function is a function in which its body is substituted with the function call. e.g.
APawn* ControlledPawn = GetPawn();
Would end up as
APawn* ControlledPawn = Pawn;
Where Pawn
is the member variable. i.e. it eliminates the overhead of the function call.
In standard C++ you would declare such function sith the inline
keyword.
inline APawn* GetPawn() const { return Pawn; }
However it’s not guarenteed to actually be inlined by the compiler, it’s basically a suggestion to the compiler that it should be inlined and it’s free to decide otherwise.
These days compilers are really good at inlining so there’s really not much of a need to mark functions as inline.
With that said for a long time compilers have supported a way to force a function to be inlined.
With MSVC that’s __force_inline
on GCC it’s __attribute__((always_inline))
That’s what the FORCEINLILNE
macro is for so that it chooses the right one depending on which compiler is being used.
Now for why they forced it to be inline is probably to increase debug performance.
I would suggest that you just let the compiler decide for you.