a question about function inlining

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux