[ODE] ODE and the STL
Jon Watte (ODE)
hplus-ode at mindcontrol.org
Mon Dec 25 11:29:28 MST 2006
Daniel K. O. wrote:
> 2006/12/25, Bram Stolk <bram at sara.nl>:
>> A list is trivially coded in C++, a vector is a bit trickier, depending
>> on how you use the vector in your app.
> Both of them are tricky if you want to do them right. Let's not suffer
> from Not Invented Here syndrome. Everybody here know how to implement
> data structures and algorithms (or at least know where to look for
> references); that's easy. The hard part is to make it compatible, fast
> and flexible. Can you garantee that the trivially implemented
> list/vector inside ODE is faster than the STL?
Let's turn the question around: Can you guarantee that a user can easily
replace the memory allocation strategy used with the STL that ODE uses?
Within ODE, memory is allocated using dALLOC() right now. If there's a
dependency on the STL, then memory will be allocated in all kinds of
contexts, including static start-up, and possibly including
non-thread-safe contexts (have been bitten several times by this).
STL is great for a self-contained application, where you control all the
variables. However, the C++ linkage model, especially on Linux, sucks
for anything resembling separately compiled SDKs/libraries. The Linux
community has very little impetus to fix this, because they believe all
applications should come in source anyway. Hence, no solution on the
Note that my judgement is not drawn from ivory tower good wishes for
best practices and goodwill unto men; they are drawn from shipping real
software SDKs on multiple platforms for the last ten years.
More information about the ODE