On Sun, Nov 23, 2003 at 07:44:55PM -0500, Larry Troxler wrote:
Argg, lost the url already - sorry.
http://www.eventhelix.com/RealtimeMantra/basics/ComparingCPPAndCPerformance....
if you don't define a destructor, then surely one won't be called.
But if there is one, it will be called whenever an object is deleted.
Either a destructor is needed, or it is not.
Sometimes it is not necessary to call a destructor each time an object is deleted; this is where an inline destructor can supposedly help (I'm not a C++ programmer, and never read a C++ book). I found this paper on C++ performance issues: http://www.cs.wustl.edu/~schmidt/PDF/perf4.pdf Inlining destructors seems tricky and dangerous.
But if you're using this class polymorphically, I don't really see how you could get better perforrmance overall by doing the equivalent thing in C (probably using function pointers).
Me neither. But again, I'm not a C++ programmer. I only hack simple C programs from time to time. I use C++ only with flext.
What am I missing here?
Nothing. I now have the impression that well written and optimised C++ code can be as fast as C, although there must a lot of poorly written C++ code used to produce bloated softwares, because object oriented programming is popular for big projects.
-- Marc