Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't recursive functions be inlined? [duplicate]

Tags:

c++

c

Possible Duplicate:
Can a recursive function be inline?

What are the trade offs of making recursive functions inline.

like image 551
Sandeep Avatar asked Nov 27 '22 00:11

Sandeep


2 Answers

Recursive functions that can be optimised by tail-end recursion can certainly be inlined. If the last thing a function does is call itself, then it can be converted into a plain loop.

like image 149
Daniel Earwicker Avatar answered Dec 13 '22 03:12

Daniel Earwicker


Arbitrary recursive functions can't be inlined for the same reason a snake can't swallow its own tail.

like image 20
caf Avatar answered Dec 13 '22 02:12

caf