Thursday 14 May 2015

Situations where inline expansion may not work

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 large or too complicated and compile the function as a normal function.

Some of the situation where inline expansion may not work are:

1. For functions returning value, if a loop, a switch, or a goto exists.
2. For functions not returning values, if a return statement exist.
3. If functions contain static variables.
4. If inline functions are recursive.

No comments:

Post a Comment