[vtk-developers] Unique PIMPL class names

Andy Cedilnik andy.cedilnik at kitware.com
Thu Jan 9 15:50:24 EST 2003


Hi All,

Recent bug in our code prompted me to the problem which appears in
several VTK classes. The problem is this:

// file1.cxx

class Foo
{
...
}

// file2.cxx

class Foo
{
...
}

When this is in the same project (can be across shared libraries), the
dynamic linker (or whoever) will have hard time figuring out which one
the code refers to. In most cases I guess it will pick the first one
that is loaded.

So, there are classes in VTK which in .cxx files use "private" classes
such as:

vtkObserver
vtkMemoryPool
vtkNeighborPoints
vtkFieldNode
vtkPWCallback
vtkColorHash

Since some of them are pretty generic names, I would suggest an
amendment to the coding standard which says:

All internally used classes have to have a name with the prefix of the
VTK class that is using it. For example if class vtkFoo needs a helper
class Bar, the helper classes name should be vtkFooBar and not vtkBar.

I would be willing to go through VTK and fix the current classes name,
but only if I will not be accused of being mad (again).

Comments?

                                   Andy





More information about the vtk-developers mailing list