[vtk-developers] new warnings: explicitly assigning a variable to itself

David Cole david.cole at kitware.com
Mon Jan 17 12:11:58 EST 2011


On Mon, Jan 17, 2011 at 12:01 PM, Brad King <brad.king at kitware.com> wrote:

> On 01/17/2011 11:21 AM, Sean McBride wrote:
> >   error = 0; error = error;
> >
> > The warning is:
> >
> > Charts/vtkPlotPointsTcl.cxx:43:20: warning: explicitly assigning a
> > variable of type 'int' to itself [-Wself-assign]
> >   error = 0; error = error;
> >              ~~~~~ ^ ~~~~~
> >
> > The purpose of "error = error" escapes me, and yet this pattern is
> > repeated in many files...
>
> It is generated by vtkWrapTcl.c, and was added in 1999:
>
>  http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=31eb8902#patch35
>
> Jim, I don't suppose you remember why?
>
> Thanks,
> -Brad
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
Don't know if Jim will chime in here with a memory from back then or not....
but if I were to guess, I'd say it was probably to suppress a warning from a
"compiler of the day" back then that produced an erroneous warning and this
was a convenient "no-op" way to shut it up. That's a complete guess, though.

It does not look like the self-assignments are necessary. I'd say we should
remove it and see what the dashboards look like without that code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110117/55ccefd1/attachment.html>


More information about the vtk-developers mailing list