[ODE] RE: ALLOCA

Gerhard Wesp gwesp at cosy.sbg.ac.at
Sat Feb 28 09:01:17 MST 2004


On Fri, Feb 27, 2004 at 05:31:17AM -0800, Shaul Kedem wrote:
> I can add to that "don't use STL with multithreaded
> apps -ever-"...

Oh dear :-/  I did exactly this, and without any problems!  But perhaps
I'm missing something...  What do I have to keep in mind?

> even then you need to be very careful with it (it has
> the tendency to call the copy constructor of the
> value's class in order to move objects around)...

I agree that this is a problem.  But it will be the same thing with just
about any conceivable resizeable random access container.  The reason is
that C++ is missing ``moving constructors'' which are like copy
constructors with the difference that the source object is no longer
needed afterwards.  A moving constructor can often be significantly
faster than a copy constructor.

Needless to say, however, that for the typical data types you would want
to put in a vector---int, double---there won't be any difference.

OK, let's close this topic now.  It's diverging too far from ODE I guess
and I have no intention of waging religious wars or to evangelize
anybody.

Kind regards
-Gerhard
-- 
Gerhard Wesp             o o           Tel.: +41 (0) 43 5347636
Bachtobelstrasse 56       |       http://www.cosy.sbg.ac.at/~gwesp/
CH-8045 Zuerich          \_/


More information about the ODE mailing list