Generally inline keyword is just a request to the compiler, and based on the function implementation the compiler will decide it's inline expansion. But is there any way we can force the function be inline and how can we do it.
            Asked
            
        
        
            Active
            
        
            Viewed 306 times
        
    4
            
            
        - 
                    2you can, but every way I've ever seen is implementation-dependent. (VS, for example, as `_forceinline`) I don't believe there is a standard-based method to do this. – WhozCraig Sep 14 '14 at 10:41
- 
                    2[`__forceinline`](http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx), [`always_inline`](http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Function-Attributes.html) – Remus Rusanu Sep 14 '14 at 10:43
- 
                    2You should not want to force the compiler inlining. Sometimes, the compiler is right in *not* inlining some function. It knows better than you will when it is good to inline. – Basile Starynkevitch Sep 14 '14 at 10:44
- 
                    Perhaps what you really want is [`/LTCG`](http://msdn.microsoft.com/en-us/library/xbf3tbeh.aspx)? (gcc [LTO](https://gcc.gnu.org/wiki/LinkTimeOptimization)) – Remus Rusanu Sep 14 '14 at 10:47
 
     
    