This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
a question about function inlining
- From: "Kollschen, Chester (Logica)" <extern dot chester dot kollschen at volkswagen dot de>
- To: "'gcc-help at gcc dot gnu dot org'" <gcc-help at gcc dot gnu dot org>
- Date: Tue, 22 Jul 2003 14:24:59 +0200
- Subject: a question about function inlining
Hello.
I know the GCC C++ compiler can inline often-called functions automatically
for performance reasons. I have to set the option -O3 for that. OK, but does
it do inlining even across libraries?
Say, I have a class like that:
class Test {
public:
Test();
~Test();
void called_very_often();
};
Test::Test() {
}
Test::~Test() {
}
void Test::called_very_often() {
// one or two statements are placed here
}
This class is compiled into a static library called Test.lib or libtest.a.
When I have a C++-Code like this:
int main(int argc, char** argv) {
Test * t = new Test();
[...]
t->called_very_often();
[...]
delete t;
}
When compiled with -O3, are there chances that the GCC C++ compiler will
inline the member method called_very_often() of library class Test in main()
even though it's compiled externally and called via a pointer? If not, what
could I do to force that?
Many Thanks! :)
Best Regards
Chester Kollschen