+ 1
Is it possible to make an inline recursive function?
2 Answers
+ 1
According to my knowledge, inline functions,
- Commonly used for calculation.
- The function call is replaced with the function logic at the time of compilation.
- Make execution faster.
- Compiled code is relatively bigger.
Yes recursion is possible with inline function, given that the function is optimize tail recursive where there is no further computation after the recursive call.
inline unsigned int product (unsigned int n,unsigned int m) {
return m == 1 ? : n + product (n,m - 1);
}