4

In C, if I mark a function as inline, and the compiler decides to inline the call, do all function calls from that function also become inlined?

3
  • 1
    1) Definitely not guaranteed, as inline doesn't even guarantee the one you marked as inline is inlined - it is the compiler's call Commented Jul 2, 2013 at 16:29
  • 1
    @AK4749 The OP seems to understand that, given he wrote "and the compiler decides to inline the call"... Commented Jul 2, 2013 at 16:30
  • @ReedCopsey yep, just saw that - it's why your answer is most appropriate. However, from knowing that, he should then know that an implicit inline is not possible - the compiler will make the judgement call in every case Commented Jul 2, 2013 at 16:31

1 Answer 1

5

In C, if I mark a function as inline, and the compiler decides to inline the call, do all function calls from that function also become inlined?

Not necessarily. Inlining a function just inlines that function body (if the compiler "agrees" to do so) - the called functions may be inlined themselves, but may not be, depending on their definition, etc.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.