News for hackers. Stuff that matters.
Re:The Hidden Cost of C++ by dkarl on Tuesday October 20, 2009 @06:04PM (#893466)
The difference is that the API can change without visible API changes.

I don't understand this at all. The performance of a C function can change without any change to the function signature. Even the destructor scenario can happen invisibly in C code for any type that already has a cleanup function. No matter whether the cleanup function is defined as "int myproj_FooCleanup(struct Foo* foo) {...}" or "myproj::Foo::~Foo() {...}", you won't notice implementation changes until runtime.

Re:The Hidden Cost of C++ by groby_b on Wednesday October 21, 2009 @09:08AM (#894554)
I'm not talking about the performance of the function itself, I'm talking about the overhead incurred. That can't change in C.

Also, just adding a virtual destructor (without any functionality) adds cost. And unfortunately, you need to if your class happens to become a base class.