Hacker News new | ask | show | jobs
by unsignedqword 3580 days ago
It can sometimes make a difference, but usually the compiler's optimizer does a good job of deciding whether or not a function should be inlined.

If you want you can nudge the compiler in the direction you want via the "inline" keyword, although the compiler won't always take this suggestion to heart. MSVC has "__forceinline" but it too will not always comply.

Before the "inline" keyword, macros were the standard way to do this, IIRC

1 comments

There's something funny about a compiler being able to ignore something called "force inline"
Sometimes it's not possible to inline functions, for example recursive calls