[vtk-developers] Data structures in VTK

Bill Hoffman bill.hoffman at kitware.com
Mon Dec 31 10:54:40 EST 2001

This comes up every once and a while.   VTK has several link-lists, arrays and 
hash tables scattered about the code.   Every once and a while, someone comes along,
and says, hey we should centralized these classes so they are not duplicated which is 
obviously bad.   Then it is said that we should not do that because these classes are
too hard to write, and STL will save us.   However, every time we try to use STL in
a project, it becomes a maintenance/portability nightmare.   STL pushes compilers to the limit.
In Insight, we are now including an ENTIRE copy of STL and the stream library in the source
CVS tree because ONE systems compiler does not ship with a thread safe version of those 
libraries.   I have a fear that if we adopted STL in VTK, within a month we would not only be
maintaining a list, array and hash table class, but rather an entire implementation
of the c++ standard library (as we have done for ITK).   

Not even taking the thread issue into consideration, with cmake, it has been very difficult
to support some of the compilers as VTK uses.  (have a look at cmStandardIncludes.h in cmake)

So the question is how long should VTK wait.   If it is more than a year, then I think
it would be better to consolidate the existing containers scattered about VTK, then just
saying that we should use STL when it works, and not fixing the existing problem of duplicated
container code.


At 01:41 PM 12/28/2001 -0500, Lorensen, William E (CRD) wrote:
>Certainly we should look at STL. For example, I believe that CMake uses some stl. Insight (the NLM
>toolkit) uses it heavily, but does have some portability problems.
>For example, SGI does not ship an STL that is thread safe. (OK the story is longer than that).
>For Insight, we have to build a development from SGI.
>It takes a long time to get these sorts of things right. I would discourage any more STL like classes
>in vtk.
>-----Original Message-----
>From: Prabhu Ramachandran [mailto:prabhu at aero.iitm.ernet.in]
>Sent: Friday, December 28, 2001 1:27 PM
>To: vtk-developers at public.kitware.com
>Subject: Re: [vtk-developers] Data structures in VTK
>>>>>> "SW" == Simon Warfield <warfield at bwh.harvard.edu> writes:
>    SW> Does it really make sense to continue to avoid using STL ?
>    SW> If vendor STLs are still too incompatible and not compliant
>    SW> with the standard, then one option would be to use a drop in
>    SW> replacement for vendor STL such as STLport
>    SW> http://www.stlport.com/product.html
>Yes, with more than 20 different compilers being supported it is
>certainly unfair to say STLport is not cross platform.  However, maybe
>the biggest worry is that by adding STLPort VTK will rope in another
>dependency, which might not be desired.  So unless compilers ship with
>a working STL it might not make sense to use STL.  That said, I find
>it hard to believe that STL is not standard enough today.
>vtk-developers mailing list
>vtk-developers at public.kitware.com
>vtk-developers mailing list
>vtk-developers at public.kitware.com

More information about the vtk-developers mailing list