4 ms·
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 y
by unsignedqword 10y 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
- colejohnson66 10y agoThere's something funny about a compiler being able to ignore something called "force inline"
- gruez 10y agoSometimes it's not possible to inline functions, for example recursive calls