When a function which take a pointer in argument is inlined, does the compiler remove the indirection during the optimization process ? Of course when it makes sense..
Here is an obvious example:
inline void say_hello (person* p) {
std::cout << "hello " << p->name << std::endl;
}
int main () {
person goldorak;
goldorak.name = "Goldorak";
say_hello(&goldorak);
return 0;
}
This case is trivial but if the compiler does the optimization is there some cases in which it doesn’t ?
Bonus: where can I get a list of some “basic” optimizations made by my compiler ?
Ps: I’m just curious
I’m assuming GCC,
and so the link you are looking for is http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
And to quote: (this may not be what you were getting at)
The equivilent documentation for Visual Studio compilers (including C++)
http://msdn.microsoft.com/en-us/library/k1ack8f1.aspx
(you can follow the links for more info)