[comp.lang.c++] inline virtual members

daniel@saturn.ucsc.edu (Daniel Edelson) (04/22/89)

Does the level of indirection used to implement virtual
member functions prevent the compiler from inlining
them (totally eliminating the function call overhead.)
It seems intuitive that this would be the case but I haven't
written a C++ compiler.

daniel edelson
daniel@saturn.ucsc.edu

grunwald@flute.cs.uiuc.edu (04/26/89)

No, you can inline virtual function calls, but only when you definitly
know the type.

e.g, assume virtual member foo::bar

	foo a;
	foo *b;

	a.bar()	-- you can inline this
	b -> bar() -- but not this, unless flow analysis shows that it can
		only be a ``foo''.
--
Dirk Grunwald
Univ. of Illinois
grunwald@flute.cs.uiuc.edu