+ 1

Is it possible to have a recursive inline function ???

13th Feb 2018, 3:30 PM
Amigo X-boy
Amigo X-boy - avatar
5 ответов
+ 2
the keyword inline is a suggestion for the compiler to inline your function so on paper or in code it is possible but the compiled code will mostlikly not be inlined or at least not endlessly
13th Feb 2018, 3:40 PM
Chrizzhigh
Chrizzhigh - avatar
0
basically it is practically not possible to have inline function.... am i right @chrizzhigh
13th Feb 2018, 3:44 PM
Amigo X-boy
Amigo X-boy - avatar
0
yes if i understood you correctly ^^
13th Feb 2018, 3:49 PM
Chrizzhigh
Chrizzhigh - avatar
0
no, inline function can't be recursive.
14th Feb 2018, 1:48 AM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
0
try it, it can but the compiler decieds how many levels it will inlines. #include <iostream> using namespace std; inline void call(int i) { if(i < 5) { call(i+1); } cout << i <<". hello" << endl; } int main() { call(0); return 0; }
15th Feb 2018, 3:14 PM
Chrizzhigh
Chrizzhigh - avatar