Inline function(oops)
Upcoming SlideShare
Loading in...5
×
 

Inline function(oops)

on

  • 3,691 views

 

Statistics

Views

Total Views
3,691
Slideshare-icon Views on SlideShare
3,691
Embed Views
0

Actions

Likes
0
Downloads
39
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Inline function(oops) Inline function(oops) Document Transcript

    • Inline function:Inline function is the optimization technique used bythe compilers. It is a function which is declared usinginline keyword or within the class. The function whichis declared within the class is said to be inline functionif it satisfies following conditions:-function should not have any return statements.-function should not be recursive function.-function length should be short.-function should not have any static variable.is considered as inline function by compiler.Inline function can only be requested to compiler, auser can only request to comlier to make a particularfuntion as an inline function, its depend on the compilerto make it as an inline function or not. An inlinefunction is used to short the execution time. Its maintask is that, it copy the body part of an inline functionwhere it is called.Its advantages are as under:
    • - It shorter the execution time.- It does not require function calling overhead- It saves time.Its disadvantages are as under:- It increases the length of our file.- It may make our file unreadable.e.g:#include<iostream>using namespace std;class number{int n;public:void setdata(){
    • n=10;}void display(){ Cout<<n;}};In above example, both of the functions will beconsidered as inline function by the compiler as itsatisfies all conditions.