[ODE] RE: ALLOCA

Gerhard Wesp gwesp at cosy.sbg.ac.at
Fri Feb 27 09:24:43 MST 2004


On Thu, Feb 26, 2004 at 06:39:06PM -0800, Jon Watte wrote:
> does not use construction semantics; instead, it's used where 
> guaranteed clien-up is required and the overhead of using a dynamic 
> allocator actually might matter.

If guaranteed clean-up matters in C++ (it always does), the Right Way
(TM) is to use standard containers.  One might also consider
std::valarray<> for high-perforance applications.

I have a linear algebra package based on std::vector<> for storage which
I have been using since two years without any performance problems.

The standard containers use ``allocators'' defined in <memory>, which
are basically classes which expose methods allocate(), deallocate(),
construct(), destroy(), etc.  Without looking in too much detail on the
alloca() replacement in ODE, I nevertheless venture the guess that the
clean way in C++ would be to wrap it and give it a standard allocator
interface.

What do you think?

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