[vtk-developers] Re: [vtkusers] Unconnected filter(s) causing seg faults

Mathieu Malaterre Mathieu.Malaterre at creatis.insa-lyon.fr
Thu Oct 16 11:14:44 EDT 2003


Charl P. Botha wrote:
> N Smethurst wrote:
> 
>> I just went through the Graphics directory and found about 4/5 without 
>> checks. I put the list at
>> kvisualiser.free.fr/vtk/null_input_check
>> if you're interested in looking at it. There are about 100 without 
>> checks.. I haven't checked any other directories.
> 
> 
> I had a look at your list.  It's much longer than I thought...
> 
>> How should the checks be implemented? I noticed that in the methods 
>> that do check, some do this
>>
>>   if (input == NULL)
>>     {
>>     vtkErrorMacro(<<"Input is NULL");
>>     return;
>>     }
>>
>> whilst others just do a
>>   if (input == NULL)
>>     {
>>     return;
>>     }
> 
> 
> Personally I prefer the first form.  At the very least we should keep 
> the error message consistent so that it can be filtered if the 
> programmer requires that.

One day ago, the second form was prefered:
http://vtk.org/cgi-bin/cvsweb.cgi/VTK/Graphics/vtkMaskPoints.cxx.diff?r1=1.41&r2=1.42

I guess sometime it can happen to have an empty input. So there is no 
reason to produce an error.

I'll go for the second form, or a vtkWarningMacro instead.


2 cents
mathieu




More information about the vtk-developers mailing list