inline specifier

From Cppreference

Jump to: navigation, search

[edit] Description

The inline keyword is used to inform the compiler that you would like it to 'paste' the function into the code whenever you call the function. The use of the inline keyword could potentially speed up the program as you avoid extra overhead created by the function call (placing data on stack and retrieving the result). The compiler has the freedom to ignore the request.

[edit] Example

inline int sum(int a, int b) 
{
    return (a + b);
}