[vtkusers] Why are all the GetXXX functions in vtkPolyData class not const?

David Gobbi david.gobbi at gmail.com
Fri Jun 3 20:30:36 EDT 2016


On Fri, Jun 3, 2016 at 5:34 PM, SY Chen <sychen52 at gmail.com> wrote:

> Does anyone know the reason why all the GetXXX functions in vtkPolyData
> class are not const?
>
In the VTK code, all objects derived from vtkObjectBase are always accessed
though non-const pointers, and have only non-const methods.  Twenty-some
years ago when VTK began, the use of "const" was much less common than
it is now.  And compilers often had const-related bugs -- for example, MSVC
would often choke if "const" was used with templates.

Changing all these methods would be a huge task, especially considering
all of the other projects that use VTK and derive classes from VTK classes.
I think the general consensus is that, in terms of improving VTK code
quality,
time would be better spent on chasing bugs and writing more unit tests for
VTK.

I'm sure this change will come eventually.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160603/760b7c06/attachment.html>


More information about the vtkusers mailing list