O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Inline function(oops)

6.280 visualizações

Publicada em

Publicada em: Tecnologia, Diversão e humor
  • Entre para ver os comentários

Inline function(oops)

  1. 1. 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:
  2. 2. - 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(){
  3. 3. 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.