There is a large, potential impact on our customers. We are already too cavalier about changing API and we've pissed off a lot of folks. I can see putting this down for a change in a major release at some point.<br>W<br>
<br><div class="gmail_quote">2008/11/7 David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I sort of agree with Karthik... It would be better if we could make VTK as a whole honor const where it makes sense. This, however, does not seem like a lightweight task by any means.<div><br></div><div>However, I also think we should make it easy for people not to have to resort to const_cast madness.<br>
<br></div><div>Changing vtkSetGet.h is a good start, but there are many method overrides in subclasses that will now have a different signature than their parent class methods unless they are carefully sought out and changed to match the new parent signature. You do not want to unintentionally change a method override to a method overload.</div>
<div><br></div><div>After thinking about this for a little while, I'd be very hesitant to make this change without reserving a lot of time for chasing down strange behavior to follow...</div><div><br></div><font color="#888888"><div>
<br></div>
<div>David</div></font><div><div></div><div class="Wj3C7c"><div><br></div><div><br><div class="gmail_quote">On Fri, Nov 7, 2008 at 1:02 PM, Karthik Krishnan <span dir="ltr"><<a href="mailto:karthik.krishnan@kitware.com" target="_blank">karthik.krishnan@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">VTK's public API as a whole does not respect constness. It might be<br>
more painful if we were to make bits and pieces of the public API<br>
const correct. Sometimes slightly correct is not better than<br>
fully incorrect.<br>
<br>
Did you also check if you would be causing the wrappers<br>
problems ?<br>
<br>
Thanks<br>
--<br>
karthik<br>
<br>
2008/11/7 Burlen Loring <<a href="mailto:burlen.loring@kitware.com" target="_blank">burlen.loring@kitware.com</a>>:<br>
<div><div></div><div>> Hi,<br>
><br>
> would anyone object to changing the vtkSetVectorXMacro's to respect const<br>
> pointers?<br>
> for eg. the change to SetVector3Macro would be:<br>
><br>
> -virtual void Set##name (type _arg[3]) \<br>
> +virtual void Set##name (const type _arg[3]) \<br>
> { \<br>
> this->Set##name (_arg[0], _arg[1], _arg[2]);\<br>
> }<br>
><br>
><br>
> This would be helpful in a situation like:<br>
><br>
> class A<br>
> {<br>
> public:<br>
> const double *GetBlah(){ return this->Blah; }<br>
> private:<br>
> double Blah[3];<br>
> };<br>
><br>
> class B : public vtkObject<br>
> {<br>
> public:<br>
> vtkSetVector3Macro(Bleh,double);<br>
> private:<br>
> double Bleh[3];<br>
> };<br>
><br>
> A a;<br>
> B *b=B::New();<br>
> b->SetBleh(a.GetBlah());<br>
><br>
> where I want to return a pointer to an array for efficiency but want to<br>
> document, and enforce, that the array's contents aren't to be modified, and<br>
> don't want to end up using const_cast's everywhere I need to pass the array<br>
> to a vtkObject.<br>
><br>
> --<br>
> Burlen Loring<br>
> Kitware, Inc.<br>
> R&D Engineer<br>
> 28 Corporate Drive<br>
> Clifton Park, NY 12065-8662<br>
> Phone: 518-371-3971 x137<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> vtk-developers mailing list<br>
> <a href="mailto:vtk-developers@vtk.org" target="_blank">vtk-developers@vtk.org</a><br>
> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
Karthik Krishnan<br>
R&D Engineer,<br>
Kitware Inc.<br>
Ph: 518 371 3971 x119<br>
Fax: 518 371 3971<br>
_______________________________________________<br>
vtk-developers mailing list<br>
<a href="mailto:vtk-developers@vtk.org" target="_blank">vtk-developers@vtk.org</a><br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
vtk-developers mailing list<br>
<a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a><br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>William J. Schroeder, PhD<br>Kitware, Inc.<br>28 Corporate Drive<br>Clifton Park, NY 12065<br><a href="mailto:will.schroeder@kitware.com">will.schroeder@kitware.com</a><br>
<a href="http://www.kitware.com">http://www.kitware.com</a><br>518-371-3971 (phone and fax)<br>