3 ms·
the no_inline attribute is non-standard, so the C++ standard has nothing say about it. In C++ marking an inline function no_inline is actually meaningful: the
by gpderetta 4y ago
the no_inline attribute is non-standard, so the C++ standard has nothing say about it.
In C++ marking an inline function no_inline is actually meaningful: the inline specifier has little to do with actually performing the inlining optimization and for the most part it means that the ODR rules are weakened (in practice enabling vague linkage). The no_inline attribute instead prevents the optimization from occurring. So an inline no_inline function is a function with vague linkage that should not be inlined.
As it allows the function to be defined in an header file and usually a function body need to be available in a translation unit, functions that should be inlined are often marked as inline (which also acts as a weak hint to the optimizer), but it is neither necessary nor sufficient. And the naming is of course for the most part historical.
- jesse__ 4y agoThis is great context, thanks for the reply.