Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Some functions can't be inlined. For example, recursive functions. Commented Apr 12, 2012 at 19:28
  • There is no golden rule. Sometimes it is better to inline (to save a function call and stack manipulations), sometimes it's not worth it (code size increases too much). You won't find The One True Answer, it doesn't exist. Commented Apr 12, 2012 at 19:30
  • fine, what about others. As i use recursive function very less. Commented Apr 12, 2012 at 19:31
  • 1
    The compiler's decision to inline is typically decided using a heuristic. Commented Apr 12, 2012 at 19:36
  • 1
    Just as a side remark, with respect of what must happen with an inline marked function that it will not create linker conflicts when its definition occurs in several compilation units. So you can safely put it in a header file. In that sense inline makes it possible that a function is inlined in several units. Commented Apr 12, 2012 at 20:26