If you moved the function definition from a header to a cpp file, you MUST remove the inline
keyword all all locations for that function. With older linkers it might make things slightly slower, but with modern linkers you should notice no real difference in performance.*
There are certain cases where a public member function can be inline
, but that's just a bad idea. Don't do it. Arguments can be made for marking certain private member functions as inline
, but in reality what you really want in those to be __attribute__((always_inline))
or __forceinline
*In extremely rare cases it will make a difference, but 99% of the time it won't, and 99.9% of what's left you don't care. If measurements show you hit that one-in-ten-thousand, you can use the aformentioned __forceinline
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…