[vtk-developers] Const correctness for string methods

Michael Halle mhalle at bwh.harvard.edu
Mon Jan 19 14:34:17 EST 2004


On Jan 19, 2004, at 2:05 PM, John Biddiscombe wrote:

>> all along the chain. If I remember that behaviour can be handled 
>> through
>> 'mutable' attributes (Brad), but I'm not sure we want to go that 
>> way...
>
> I'd like to see const correctness handled properly. The downside is the
> chain of changes and mutable properties, but the upside is safer code 
> and
> better optimization by decent compilers.

I understand the general software engineering principle at work here, 
but
from a practical level with regard to VTK, does either the extra safety
or the optimization really buy you much in practice?  Are we seeing lots
of problems because of a violation of implicit (rather than declared)
constness?

>  It's a nasty change to make, but if
> we're serious about making vtk rock solid, then we should do it (and 
> not
> just for string getters).
>
> It's not much worse for people than changing everything to double from
> float - which let's face it has completely buggered all my code, but 
> I'm
> willing to work on it for the sake of progress.

But at least it's possible to list real problems the float -> double
conversion fixed (although it caused plenty of mayhem, may internally
fork vtk by holding a bunch of people back at vtk-4.2.x, and has an
as-yet-unknown impact on performance on different platforms).
What ACTUAL (as opposed to theoretical) problems occur now,
and what ACTUAL optimizations are likely with this potentially
significant change?

If VTK were being written today, rather than being changed, the balance
would be different.

All that said, if you decide to make this change, do it now while
everyone's code is in disarray after float -> double.

--Mike




More information about the vtk-developers mailing list