- inlining is not a universally "bad idea", it certainly won't decrease performance. It might significantly increase object size.
Incorrect. Increasing code size decreases cache hit rate, decreasing performance.
Not always. It depends on whether the code fit in the cache in the first place. Or whether it no longer fits with the inlining. The corollary: decreasing code size certainly doesn't always increase performance.
- Finally: inlining can be dangerous during multiple compile cycles if the function changes if dependent modules are not recompiled, since the old version of the function could have been inlined into another module, and you end up with module A having inlined version1 and module B inlined version2.
This is just silly. If this occurs, there is a bug in your build system.
No serious programmer worries about this.
Include files aren't always properly declared as dependencies in makefiles. I can tell you from firsthand that bugs do happen because of this. A bug in your build file is still a bug. This isn't an argument against inlining though, just a reason to be careful.
- Declaring a function 'static' in a C program when that function is not declared in the header means that the symbol is not exported, and allows the compiler to inline as it see fit. 'inline' is utterly unnecessary to make the function be inlined.
These two statements don't match up. If you want to "make" (force) the function be inlined, then you obviously do not wish to leave that decision to the compiler.
You can specify the inline keyword, but the compiler won't necessarily listen to you. Some compilers to have special pragmas to force inlining, but they are not a part of the C++ standard.
[/list]