[vtk-developers] Warning in VTK

Lisa Avila lisa.avila at kitware.com
Thu Feb 21 12:05:04 EST 2002


Berk,

I like using assignments in conditionals too. I guess it is just not 
possible to have the compiler find the thinks you didn't mean ( like if ( x 
= 3 ) {} ) but not the things you did mean. Are these warnings showing up 
on the dashboard? If so I vote for turning them off because I start to 
ignore warnings if they are there consistently. Only if we typically have 
no warning will people clean up warnings when they are introduced into the 
code.

Lisa



At 11:16 AM 2/21/2002, Berk Geveci wrote:
>I think that it is a bad idea to start changing our valid code to avoid
>Microsoft compilers warnings (which are never up-to-date with standards
>anyway). If I know what I am doing, why shouldn't
>I use:
>
>I ( (foo=somefunction()) != -1 )
>  {
>   do something with foo
>  }
>
>? I use this all the time and I think if the vtk coding "standard"
>disallowed this, many developers will ignore that "standard".
>Personally, I would not use the /W4 option just to get a warning
>for the above (also, at the expanse of time). I say leave it alone
>and if you are worried about missing real problems, learn to live
>with the compiler warnings for valid code.
>
>-Berk
>
>On Thu, 2002-02-21 at 10:51, Andy Cedilnik wrote:
> >
> > >>All these cases are valid code and should not be reported as warnings.
> > >
> > >Valid code? - yes, but the right code? - probably not. We can easily
> > >change all while (1) statements to use a conditional variable, and the
> > >#define case seems like something that should be done another way as 
> well.
> > >That will get rid of the warnings and still pick up the case where 
> someone
> > >does something silly like if ( x = 1 ) {}.
> >
> > So should we add this to VTK coding standard?
> > I mean, if this is a decision, then I suggest we put it in the 
> standard, and
> > make everybody use /W4.
> >
> > Also, here is another case that is a "valid code":
> >
> > if ( sizeof(int) == 4 )
> > {
> >          // Do something
> > }
> >
> > sizeof(int) is replaced with constant and so this also issues
> > a warning. So, is this "valid code" or valid code?
> >
> >
> >                          Andy
> >
> > _______________________________________________
> > vtk-developers mailing list
> > vtk-developers at public.kitware.com
> > http://public.kitware.com/mailman/listinfo/vtk-developers
>
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at public.kitware.com
>http://public.kitware.com/mailman/listinfo/vtk-developers




More information about the vtk-developers mailing list