PDA

View Full Version : QT + mingw and 'inline' functions?



tonnot
24th February 2011, 08:28
What is your opinion about using inline functions?
I'm using QT+mingw.

I have read in some place that 'modern compilers' do optimizing works to make 'autoinline' if neccessary... (or something like this)

Any idea ? Thanks

agarny
24th February 2011, 08:43
Personally, I don't bother with them any more. As you said, compilers are clever enough nowadays, so... I leave it to them to decide what is best. Also, inlining can, in some cases, make things worse, so...

tonnot
24th February 2011, 09:39
But, if you see at QT code, you can see inline functions....

agarny
24th February 2011, 09:49
But, if you see at QT code, you can see inline functions....Yes and so what? :) It's their call and I gave you mine. Now, one might argue that their call is probably better than mine, and that is completely fine with me. Still, at the end of the day, it's your decision. So, just gather as much information as possible and decide for yourself, e.g. http://www.parashift.com/c++-faq-lite/inline-functions.html http://yosefk.com/c++fqa/inline.html

high_flyer
24th February 2011, 09:58
You might want to read this:
http://www.parashift.com/c++-faq-lite/inline-functions.html

tonnot
24th February 2011, 10:00
Thank you very much

wysota
25th February 2011, 10:43
But, if you see at QT code, you can see inline functions....

Qt is available for more than one compiler and not all compilers are equally smart. Besides, forcing a function to be inlined has its merits (e.g. you don't need to have the .cpp file for a class).