On 2014.11.14 at 01:19 -0500, Trevor Saunders wrote: > On Thu, Nov 13, 2014 at 03:48:34PM +0100, Markus Trippelsdorf wrote: > > On 2014.11.13 at 15:11 +0100, mliska wrote: > > > > > + /* Destructor. */ > > > + virtual ~cgraph_summary () > > > + { > > > + destroy (); > > > + } > > > > From https://gcc.gnu.org/wiki/CppConventions: > > > > Constructors and destructors are often much larger than programmers > > expect. Prefer non-inline versions unless you have evidence that the > > inline version is needed. > > I never really agreed with that, and we don't really follow it. However > it really doesn't matter in this case since its virtual.
It doesn't really matter if the destructor is virtual or not, because the same bloat can happen. Consider a trivial example that I've found on the web and compare the assembly output with "virtual ~A ()" defined inline vs. out-of-line: #include <string> using namespace std; class A { string name; string address; string telephone; public: A (){}; virtual void function () { } virtual ~A () {} }; //A::~A (){}; class B : public A { public: B (){}; void function () { } ~B () {} }; void abc () { B b; b.function (); } int main () { B b; b.function (); abc (); } -- Markus