Optimization, inline functions
Lee, Newbie
utmw0@hanmail.net
Fri Jul 4 05:34:00 GMT 2008
I thought function inlining is simple and easy thing.
But I read that gcc doesn't make function inline without optimization flag,
and function inlining is the last thing to do when gcc optimize something.
So I compiled a cpp file with -S and -O1, -O2, -O3 flags.
Document says that only -O3 turns on function inlining,
but with -O2, gcc also eliminated function calls.
The result was better than I expected. But I am confusing.
0. Does 'gcc -O2' make functions inline?
1. Is function inlining is dangerous?
2. Is 'gcc -O3 ' safe? (I heard -O2 is recommended)
and any advice about this will help me.
Thanks.
(Here's my test cpp. and .s results)
http://www.nabble.com/file/p18273137/test.cpp test.cpp
http://www.nabble.com/file/p18273137/testO1.s testO1.s
http://www.nabble.com/file/p18273137/testO2.s testO2.s
http://www.nabble.com/file/p18273137/testO3.s testO3.s
--
View this message in context: http://www.nabble.com/Optimization%2C-inline-functions-tp18273137p18273137.html
Sent from the gcc - Help mailing list archive at Nabble.com.
More information about the Gcc-help
mailing list