4 ms·
And of course there is still the difference between "has an inline directive" and "gets inlined" - it's merely a strong suggestion in most compilers.
by detaro 5y ago
And of course there is still the difference between "has an inline directive" and "gets inlined" - it's merely a strong suggestion in most compilers.
- asdfasgasdgasdg 5y agoSure. In this case I was reading the disassembled code, so I could verify that large swathes of code were in fact getting inlined. I believe the code in question was using the clang-specific always_inline attribute. https://clang.llvm.org/docs/AttributeReference.html#always-inline-force-inline https://clang.llvm.org/docs/AttributeReference.html#always-i...
- stkdump 5y agoI'm not so sure it is even a strong suggestion. Actually inline nowadays mostly has a semantic meaning - the symbol can be defined in multiple compilation units without causing multiple definition errors from the linker. Usually you can't remove it without moving the definition from a header file to an implementation file. Edit: it is correct though, that the inline keyword often is a neccessity to allow the compiler to inline in the first place. After all, the compiler can only inline a function at the callsite, when both are in the same translation unit. Either the function is only used in one translation unit, or it has to be defined as inline (or worse as hidden to the linker by static or anonymous namespace). Disregarding LTO, of course.