When should I write the keyword inline
for a function/method in C++?
After seeing some answers, some related questions:
When should I <
Inline keyword requests the compiler to replace the function call with the body of the function ,it first evaluates the expression and then passed.It reduces the function call overhead as there is no need to store the return address and stack memory is not required for function arguments.
When to use:
- To Improve performance
- To reduce call overhead .
- As it's just a request to the compiler, certain functions won't be inlined *large functions
- functions having too many conditional arguments
- recursive code and code with loops etc.