Benefits of inline functions

This tip submitted by Ali Nawkhas Murad on 2012-02-02 21:57:11. It has been viewed 15989 times.
Rating of 5.5 with 144 votes

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;

More tips

Help your fellow programmers! Add a tip!