[vtk-developers] Warning in VTK

Berk Geveci berk.geveci at kitware.com
Thu Feb 21 11:16:25 EST 2002


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





More information about the vtk-developers mailing list