Benefits of inline functions in c++?

0 votes
29 views
asked Dec 17, 2013 in C++ by rick
hI all

  Benefits of inline functions in c++??

1 Answer

0 votes
answered Dec 17, 2013 by Ali Nawkhas Murad

In hard real time systems, the most important factor is execution time of codes. So when you call functions especially in loops you loss a time for calling a function and return from it. To avoid this lose of time (no need for function call mechanism) put inline keyword in front of a function declaration as shown below: 
 

inline double cube( double x) 
{
    return x*x*x;
}
...