[vtk-developers] Proposed API change: vtkAbstractArray constructor argument

David Lonie david.lonie at kitware.com
Wed Jul 24 14:18:21 EDT 2013


Hi list,

I'm running into issues with vtkAbstractArray's constructor. Breaking
VTK conventions, the constructor takes an argument, 'vtkIdType
numComps'. It has a default value of one, and it doesn't look like it
is ever called with an explicit argument (Modifying the constructor to
segfault when numComps != 1 and running the test suite showed no
failures).

The constructor argument is propagated all the way down the
vtkDataArray hierarchy -- classes like vtkFloatArray all have it.
These classes use the static New() pattern with protected
constructors, so the argument seems unnecessary.

It looks like a relic of days-gone-by, before the current conventions
and New() pattern were put into place. Are there any reasons for
keeping it around, or can I remove it?

Thanks,
Dave

(tl;dr: For the curious, I'm adding vtkTypeTemplate classes into the
vtkDataArray hierarchy, and in order to get that class to work with
this constructor, I'll need to add multiple parallel specializations
of vtkTypeTemplate with the additional constructor. This adds a lot of
code to maintain and is proving to be a headache to get right in a
cross-platform manner. Since the argument isn't used and violates
convention, it makes more sense to me that we just fix the
constructors, rather than jump through hoops to keep them.)



More information about the vtk-developers mailing list