- Jumping back and forth and keeping trace of where to jump means that there is an overhead in elapsed time to using functions.
- Inline functions provide an alternative.
- The compiler replaces the function call with the corresponding function code. With inline code, the program doesn't have to jump to another location to execute the code and then jump back.
- Inline function run a little faster than regular functions, but they come with a memory penalty.
- You should be selective about using inline functions. If the time needed to execute the function code is long compared to the time need to handle the function call mechanism, then the time saved is a relatively small portion of the entire process. If the code execution time is short, then an inline call can save a large portion of the time used by the non-inline call.
- To use this feature, you must take at least one of two action:
- Preface the function declaration wiith the keyword inline.
- Preface the function definition with the keyword inline.