문제

I have a doubt regarding inline functions. Inline functions will not involve any function calls but just replacement of function definition wherever the call is made to the inline function.Inline functions have type enforcement unlike macros. What will happen if recursive functions are made inline?

도움이 되었습니까?

해결책

"inline" isn't a guarantee, it's a request.

Your recursive inline function won't (typically) be inline.

  • As some commenters point out, there are special cases (e.g. using compiler-specific pragmas) in which inlining is possible.

다른 팁

inline is merely a suggestion to the compiler and does not guarantee that a function will be inlined.

Obviously, the compiler won't be able to inline a recursive function infinitely. It may not inline it at all or it may inline it just a few levels deep.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top