Inline functions in c++

89 views
76 views

Published on

Inline functions in c++
Index-
What is inline function?
Why use inline function?
When to use inline function?
How to make a normal function, inline?
Inline is a request or command?

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
89
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Inline functions in c++

  1. 1. Inline functions in C++ Presented by Harish Gyanani
  2. 2. Index (Questions answered in this ppt) • What is inline function? • Why use inline function? • When to use inline function? • How to make a normal function, inline? • Inline is a request or command?
  3. 3. What is inline function? • An inline function is a function that is expanded in line when it is invoked. • The compiler replaces the function call with the corresponding function code. • If a function is inline, the compiler places a copy of the code of that function at each point where the function is called at compile time.
  4. 4. Why use inline function? To eliminate the cost of calls to small functions, we use inline function.
  5. 5. When to use? The functions are made inline when they are small enough to be defined in one or two lines.
  6. 6. How to make a normal function inline? It is easy to make a function inline. All we need to do is to prefix the keyword inline to the function definition. All inline functions must be defined before they are called.
  7. 7. Inline is a request, not a command The inline keyword merely sends a request, not a command, to the compiler. The compiler may ignore this request if the function definition is too long or too complicated and the function as a normal function.

×