why we use inline function if there are simple function available, or what is the spacial benefit of inline function over simple functionView more random threads:
- how i can leave spaces between my program output
- What are Concrete Classes in c++ 2011?
- why we don’t use semicolon at the end of a function in C++?
- Linked list using arrays?
- how to insert a new node on AVL tree using double rotation?
- compiler is compiling our source coad so course code is...
- question adout c++ 2011
- object oriented programming what does it mean and what are...
- How to Write a function factorial in C++ and java and php...
- Revised Student Record Code written in C++ 2011-12
Sponsored Links
A function is declared inline by using the inline function specifier or by defining a member function within a class or structure definition. The inline specifier is only a suggestion to the compiler that an inline expansion can be performed; the compiler is free to ignore the suggestion. The following code fragment shows an inline function definition.
inline int add(int i, int j)
{
return i + j;
}
An inline function is one for which the compiler copies the code from the function definition directly into the code of the calling function rather than creating a separate set of instructions in memory. Instead of transferring control to and from the function code segment, a modified copy of the function body may be substituted directly for the function call. In this way, the performance overhead of a function call is avoided.
There are currently 1 users browsing this thread. (0 members and 1 guests)