[OT] Re: (That C++ is slower thing again) Re: the damned GUI - was:[PD] Pd in white on black and OSC

Larry Troxler lt at westnet.com
Mon Nov 24 01:44:55 CET 2003


On Sunday 23 November 2003 17:29, Marc Lavallée wrote:
> On Sun, Nov 23, 2003 at 04:52:14PM -0500, Larry Troxler wrote:
> > Really? It says that for you? To me, it says that C++ adds some overhead
> > (not quite the right word) which, if you were coding in C, you would
> > have to add anyway.
>
> It says that to do the same in C than in C++, it's necessary to add what's
> missing in C. But it also says that C++ always call destructors even when
> not necessary, and that there's ways to reduce this overhead.

Argg, lost the url already - sorry. You're interpretation certainly sounds 
bogus to me though - if you don't define a destructor, then surely one won't 
be called. Possibly in some implementations, there's overhead if you declare 
a do-nothing virtual destructor in the base class. But if so, I wonder how 
the equivalent C implementation would do any better. Either a destructor is 
needed, or it is not. Yes, granted, if you have a base class like: " class C 
{ int x; public: virtual ~C {} }", then true, the base destructor will always 
be called even rhough it is empty (I suppose this depends on how smart the 
compiler is). 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). What am I missing here?


> C++ can
> certainly be as effective, fast, etc, than C, if programs are carefully
> coded. We're not disagreeing. Peace and joy to C++ coders of the universe.

And likewise, may all the C coders enjoy profound joy and peace.

Larry





More information about the Pd-list mailing list